removed print statments and purged commented code

master
Castro0o 7 years ago
parent bdd41cb96b
commit d24cf2cdf2

@ -1,49 +0,0 @@
# Remotes
remote pzi1 ssh://acastro@pzwart1.wdka.hro.nl:/home/acastro/pzimediadesign.nl.git (fetch)
production: pzi2 /var/www/mmdc-site `git pull origin master`
# TODO
## 2015 page
is not being generate. instead 2016 generates it self - FIX
## sustainability
On the long run it would be nice to keep updating the pages, via script
But then, future of the program is uncertain ATM
------------
# pzimediadesign.nl as landing page
with links to:
* Lensbased Media
* Experimental Publishing
* Graduation Show 2016
## Changes
### to pages & templates
* (static) index "index.html" w/ links is static with links to subdomains and gradshow
* (generated) 2015 gradshow (old index template, but without PZI intro)
```def creat_index``` ```"gradshow-template.html" --> "web/2015.html"```
* ```mv "index-template.html" "gradshow-template.html"```
"gradshow-template.html" remains the same but without intro text about program course.
### Questions
* ? Do Simon & Aymeric wanna maintain the same common text ?
## TO DO
Bring content upwards

@ -27,29 +27,22 @@ def mw_cats(site, args): #returns pages member of args(categories)
last_names = None
# cats = site.Categories[args.category]#category, 'Graduation_work']
for category in years:#args.category:
print 'cat:', category
#print 'cat:', category
cat = site.Categories[category]#, 'Graduation_work']
print 'site cats:', cat, type(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
#print 'pages:', pages
# check whether pages are also part of Category Graduation_work
for p in pages:
print 'page:', p, last_names
#print 'page:', p, last_names
#pages_by_name[p.name] = p
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)
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
# 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"
return [p.name for p in results]

@ -14,23 +14,13 @@ from random import shuffle
# * the --category provides the year. I.e. 2017
# * year does not need to be indicated in arguments
#
# * work page generation uses: work-YYYY-template.html
# * work pages generation uses: work-YYYY-template.html
# * graduation year index pages generation uses: index-template-YYYY.html
#
#
################
### TO DO ######
#
# Issues @current commit
# * index pages templates
# *
#
# create_page(memberpages, 'preview') : use work_yyyy_templates rather than args.category ['year']
# * change index templates
#
#########
#####
######
# Args
####
p = ArgumentParser()
@ -42,22 +32,12 @@ p.add_argument("--preview", help='Preview page. Will override category querying.
args = p.parse_args()
print 'args', args
# for i in args.category:
# if '20' in i:
# global year
# year = i
# print year
######
# DEFS: create_pages create_index
######
def create_pages(memberpages, mode):
indexdict = {} #parent dict: contains articledict instances
for member in memberpages:
print member
page = mw_page(site, member)
page_text = mw_page_text(site, page)
articledict = parse_work(site, member, page_text) # create dictionary
@ -104,10 +84,8 @@ def create_pages(memberpages, mode):
#print
figures = page_tree.findall('.//figure')
images = page_tree.findall('.//img')
#print 'Number of imgs:', len(images)
if len(figures) > 0:
#print 'figures', figures
for figure in figures:
img = figure.find('.//img')
figcaption = figure.find('.//figcaption')
@ -125,9 +103,9 @@ def create_pages(memberpages, mode):
else:
for img in images:
img_src = img.get('src')
print img_src
#print img_src
src = (('File:'+img_src).capitalize()).decode('utf-8')
pprint.pprint(articledict)
#pprint.pprint(articledict)
if src in articledict['Imgs'].keys(): #full-url
url = (articledict['Imgs'][src])
#print url
@ -150,13 +128,10 @@ def create_index(indexdict, year):
index_container = index_tree.find(".//div[@class='isotope']") #maybe id is imp
works = indexdict.keys()
print '\n\n******* indexdict keys: works ***********\n\n'
print(works)
#print '\n\n******* indexdict keys: works ***********\n\n'
#print(works)
for work in works:
print '---TITLE:', indexdict[work]['Title']
print '---PATH:', indexdict[work]['Path']
index_addwork( parent=index_container,
workid=work,
href=indexdict[work]['Path'],
@ -184,33 +159,22 @@ def create_index(indexdict, year):
# ACTION
#####
site = mwsite(args.host, args.path)
# print "** New Index Mode **"
memberpages=mw_cats(site, args)
# print '\n\nmemberpages:\n\n', memberpages, '\n\n********\n\n' # memberpages include years, from current to 2015
indexdict = create_pages(memberpages, 'index')
# indexdict[u'A Unique Line']['Date']
# rather than interveening in the create_index or create_pages
# I will place create_index in a loop
# with sublist of idexdict for each year
indexdict_byyear={year:{} for year in years }
indexdict_byyear={year:{} for year in years } # index of all page organized according to year
# indexdict_byyear structure:
# {year1:{ work1: {work1 prop:vals}, work2: {...} }, year2:..., year3: }
# {2015: {u'A Unique Line': {'Bio': u'<p>Jun
# {2015: {u'A Unique Line': {'Bio': ...}}}
for key in indexdict.keys(): # populate indexdict_byyear with works
indexdict_byyear[ int(indexdict[key]['Date'])][key] = indexdict[key]
print '\n\n******* indexdict_byyear ***********\n\n'
pprint.pprint( indexdict_byyear )
#print '\n\n******* indexdict_byyear ***********\n\n'
#pprint.pprint( indexdict_byyear )
for year in indexdict_byyear.keys(): # create index page for each year ie 2016.html
print '\n***** ', year, ' *****\n'
create_index(indexdict_byyear[year], year)
# print '\n\n******* indexdict ***********\n\n'
# pprint.pprint(indexdict)
# print '\n\n******* loop indexdict ***********\n\n'

Loading…
Cancel
Save