|
|
@ -16,6 +16,7 @@ def mwsite(host, path): #returns wiki site object
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def mw_cats(site, args): #returns pages member of args(categories)
|
|
|
|
def mw_cats(site, args): #returns pages member of args(categories)
|
|
|
|
|
|
|
|
pages = []
|
|
|
|
last_names = None
|
|
|
|
last_names = None
|
|
|
|
# cats = site.Categories[args.category]#category, 'Graduation_work']
|
|
|
|
# cats = site.Categories[args.category]#category, 'Graduation_work']
|
|
|
|
years = range(2015, int(args.category[0])+1 )
|
|
|
|
years = range(2015, int(args.category[0])+1 )
|
|
|
@ -23,21 +24,27 @@ def mw_cats(site, args): #returns pages member of args(categories)
|
|
|
|
for category in years:#args.category:
|
|
|
|
for category in years:#args.category:
|
|
|
|
print 'cat:', category
|
|
|
|
print 'cat:', category
|
|
|
|
cat = site.Categories[category]#, 'Graduation_work']
|
|
|
|
cat = site.Categories[category]#, 'Graduation_work']
|
|
|
|
print 'site cats:', cat
|
|
|
|
print 'site cats:', cat, type(cat.members())
|
|
|
|
pages = list(cat.members())
|
|
|
|
for i in list(cat.members()):# add members(objects) of cat as list, to pages list
|
|
|
|
|
|
|
|
pages.append(i)
|
|
|
|
print 'pages:', pages
|
|
|
|
print 'pages:', pages
|
|
|
|
|
|
|
|
|
|
|
|
# check whether pages are also part of Category Graduation_work
|
|
|
|
# check whether pages are also part of Category Graduation_work
|
|
|
|
|
|
|
|
|
|
|
|
for p in pages:
|
|
|
|
for p in pages:
|
|
|
|
p
|
|
|
|
print 'page:', p, last_names
|
|
|
|
#pages_by_name[p.name] = p
|
|
|
|
#pages_by_name[p.name] = p
|
|
|
|
if last_names == None:
|
|
|
|
if last_names == None: # what the duck am I doing here w/ last_names??
|
|
|
|
results = pages
|
|
|
|
results = pages
|
|
|
|
else:
|
|
|
|
# else:
|
|
|
|
results = [p for p in pages if p.name in last_names]
|
|
|
|
# results = [p for p in pages if p.name in last_names]
|
|
|
|
last_names = set([p.name for p in pages])
|
|
|
|
# last_names = set([p.name for p in pages])
|
|
|
|
results = list(results)
|
|
|
|
# results = list(results)
|
|
|
|
|
|
|
|
print "\n*** p.name ***\n", [p.name for p in pages], "\n******\n"
|
|
|
|
|
|
|
|
print "\n**p.name in results****\n", [p.name for p in results], "\n******\n"
|
|
|
|
|
|
|
|
# pages and results seems to be the same list, except if has been filtered
|
|
|
|
|
|
|
|
# but both are reset at each pass of the years loop
|
|
|
|
|
|
|
|
|
|
|
|
return [p.name for p in results]
|
|
|
|
return [p.name for p in results]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|