|
|
|
@ -16,6 +16,7 @@ def mwsite(host, path): #returns wiki site object
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def mw_cats(site, args): #returns pages member of args(categories)
|
|
|
|
|
pages = []
|
|
|
|
|
last_names = None
|
|
|
|
|
# cats = site.Categories[args.category]#category, 'Graduation_work']
|
|
|
|
|
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:
|
|
|
|
|
print 'cat:', category
|
|
|
|
|
cat = site.Categories[category]#, 'Graduation_work']
|
|
|
|
|
print 'site cats:', cat
|
|
|
|
|
pages = list(cat.members())
|
|
|
|
|
print 'site cats:', cat, type(cat.members())
|
|
|
|
|
for i in list(cat.members()):# add members(objects) of cat as list, to pages list
|
|
|
|
|
pages.append(i)
|
|
|
|
|
print 'pages:', pages
|
|
|
|
|
|
|
|
|
|
# check whether pages are also part of Category Graduation_work
|
|
|
|
|
|
|
|
|
|
for p in pages:
|
|
|
|
|
p
|
|
|
|
|
print 'page:', p, last_names
|
|
|
|
|
#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
|
|
|
|
|
else:
|
|
|
|
|
results = [p for p in pages if p.name in last_names]
|
|
|
|
|
last_names = set([p.name for p in pages])
|
|
|
|
|
results = list(results)
|
|
|
|
|
# else:
|
|
|
|
|
# results = [p for p in pages if p.name in last_names]
|
|
|
|
|
# last_names = set([p.name for p in pages])
|
|
|
|
|
# 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]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|