diff --git a/mmdc_modules.py b/mmdc_modules.py index a77c850..0b0686d 100644 --- a/mmdc_modules.py +++ b/mmdc_modules.py @@ -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] diff --git a/mmdc_wiki2web.py b/mmdc_wiki2web.py index c51b9c3..324c0b5 100755 --- a/mmdc_wiki2web.py +++ b/mmdc_wiki2web.py @@ -11,14 +11,25 @@ from random import shuffle # * each year has its own html template in YYYY-template.html # * the --category provides the year. I.e. 2017 # -# * # # ################ ### 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 # * how & why are years and works mixed?? ######### @@ -177,8 +188,11 @@ if args.preview is not None: else: print "** New Index Mode **" memberpages=mw_cats(site, args) - print 'memberpages:', memberpages - indexdict = create_page(memberpages, 'index') + print '\n\nmemberpages:\n\n', memberpages, '\n\n********\n\n' # X memberpages includes only set year + indexdict = create_page(memberpages, 'index') # X indexdict includes only set year create_index(indexdict) - + print + print '******************' + print + pprint.pprint(indexdict)