creating all works from all years. But all are place in index

master
Castro0o 7 years ago
parent 1e0a822acb
commit fd216b62c7

@ -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]

@ -11,14 +11,25 @@ from random import shuffle
# * each year has its own html template in YYYY-template.html # * each year has its own html template in YYYY-template.html
# * the --category provides the year. I.e. 2017 # * the --category provides the year. I.e. 2017
# #
# *
# #
# #
################ ################
### TO DO ###### ### TO DO ######
# * from the year set loop through the years between it and 2015 in mw_cats loop [DONE] # * [DONE] in def mw_cats(): select pages member of the years from 2015 to the indicate year
# * # ** [DONE] resulting in all work pages from those year being created
# ** [DONE] the creation of the index pages is missing
#
# Issues @current commit
# * index.html page contains ALL works from ALL years, not just the last
# * year.html contain none
#
# indexdict = create_page(memberpages, 'index') # X indexdict includes only set year
# and # create_index(indexdict)
# * update/create index pages:
#
# * let program define year
#
# * For different user categories serve different templates # * For different user categories serve different templates
# * how & why are years and works mixed?? # * how & why are years and works mixed??
######### #########
@ -177,8 +188,11 @@ if args.preview is not None:
else: else:
print "** New Index Mode **" print "** New Index Mode **"
memberpages=mw_cats(site, args) memberpages=mw_cats(site, args)
print 'memberpages:', memberpages print '\n\nmemberpages:\n\n', memberpages, '\n\n********\n\n' # X memberpages includes only set year
indexdict = create_page(memberpages, 'index') indexdict = create_page(memberpages, 'index') # X indexdict includes only set year
create_index(indexdict) create_index(indexdict)
print
print '******************'
print
pprint.pprint(indexdict)

Loading…
Cancel
Save