Changeset 140
- Timestamp:
- 02/27/06 09:59:49 (3 years ago)
- Files:
-
- branches/timhtcopy/pyramid/build.py (modified) (1 diff)
- branches/timhtcopy/pyramid/flatteners.py (modified) (1 diff)
- branches/timhtcopy/pyramid/mkpydir.py (modified) (2 diffs)
- branches/timhtcopy/pyramid/page.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/timhtcopy/pyramid/build.py
r136 r140 176 176 parser.add_option("-R", "--rebuilddirs",dest="rebuilddirs",help="only rebuild below these comma separated directories",metavar="REBUILDDIRS") 177 177 parser.add_option("-c", "--constants", dest="constants", help="pass in the names constants (e.g. PDO=/root/pdo,PSF=/psf", metavar="CONSTANTS") 178 parser.add_option("-U", "--update", action="store_true", dest="update", default=False, help="NOT WORKING try to build only those pages that have changed")178 parser.add_option("-U", "--update", action="store_true", dest="update", default=False, help="NOT WORKING DO NOT USE try to build only those pages that have changed") 179 179 (options, args) = parser.parse_args() 180 180 main(options,args) branches/timhtcopy/pyramid/flatteners.py
r136 r140 129 129 class WikiUrlFlattener(components.Adapter): 130 130 def flatten(self, ctx, dir): 131 from pyramid import moinmoin 132 url = expandConstants(ctx,dir,self.original) 133 from pprint import pprint 134 pprint(url) 135 contents = moinmoin.parse(url) 131 try: 132 from pyramid import moinmoin 133 url = expandConstants(ctx,dir,self.original) 134 contents = moinmoin.parse(url) 135 except: 136 print 'moinmoin parse error, replacing with a marker' 137 contents = '<strong>MoinMoin parse failed for %s - a wiki instance needs to be installed and the wikiconfig.py directory needs to be on the $PYTHONPATH</strong>'%url 136 138 return T.xml(contents) 137 139 branches/timhtcopy/pyramid/mkpydir.py
r127 r140 46 46 def mkpydir(directive,prefix,path,outputdir,copy,title): 47 47 OUTPUTDIR = os.path.abspath(outputdir) 48 os.mkdir(OUTPUTDIR) 48 if os.path.isdir(outputdir) is not True: 49 os.mkdir(OUTPUTDIR) 49 50 50 51 if directive == 'htfile': … … 91 92 92 93 def parseOptions(): 93 usage = "usage: mkpydir -t <type (wikiurl|htfile|html|rest)> [-d <prefixdirforsourcefile>] -p <pathtosourcefile> -o <outputdir> [-l] [-R]" 94 usage = """usage: mkpydir -t <type (wikiurl|htfile|html|restfile)> [-d <prefixdirforsourcefile>] -p <pathtosourcefile> -o <outputdir> [-l] [-R] 95 examples 96 to create a page from a restructured text file 97 mkpydir -t restfile -d $HOME/pythondocs -p mypage.rst -o $HOME/beta.python.org/build/data/mynewpagedir 98 to create a page from a htfile file (copying the contents into the pyramid dir) 99 mkpydir -t htfile -d $HOME/pydotorg/trunk -p /Help.ht -o $HOME/beta.python.org/build/data/help 100 to link in some content from the pydotorg tree such that it always builds from the original 101 mkpydir -t htfile -l -p /Help.ht -o $HOME/beta.python.org/build/data/help 102 to include a wiki page 103 mkpydir -t wikiurl -d http://wiki.python.org/moin -p /Applications -o $HOME/beta.python.org/build/data/applications 104 to perform the above operation and create the page below the current directory 105 mkpydir -t wikiurl -d http://wiki.python.org/moin -p /Applications -o . 106 """ 94 107 parser = OptionParser(usage) 95 108 parser.add_option("-t", "--type", dest="type", help="the type of pydir content to be created", metavar="TYPE") 96 parser.add_option("-d", "--dir", dest="dir", help="the root directory for the an asset (to be used when sourcing pydotorg or wiki content)", metavar="DIR")109 parser.add_option("-d", "--dir", dest="dir", help="the root directory for the an asset (to be used when copying pydotorg or wiki content)", metavar="DIR") 97 110 parser.add_option("-p", "--path", dest="path", help="the path to the asset", metavar="PATH") 98 111 parser.add_option("-o", "--outputdir", dest="outputdir", help="directory in which to create the pyramid directory", metavar="OUTPUTDIR") branches/timhtcopy/pyramid/page.py
r42 r140 1 import sys 1 2 from nevow import rend, stan, flat, compy as components, tags as T 2 3 from nevow.loaders import xmlstr … … 13 14 pgen['divider'] = str 14 15 return pgen 16 17 class FragmentError(Exception): 18 """Base class for fragment exceptions.""" 19 pass 15 20 16 21 class Fragment(rend.Page): … … 58 63 def render_breadcrumb(self, ctx, data): 59 64 tag = ctx.tag 60 for item in data[:-1]: 61 tag[ T.a(href=item['href'])[item['label']],' ',T.span(class_="breadcrumb-separator")[ T.xml('>') ] ,' '] 62 tag[ data[-1]['label'] ] 65 print data 66 try: 67 for item in data[:-1]: 68 tag[ T.a(href=item['href'])[item['label']],' ',T.span(class_="breadcrumb-separator")[ T.xml('>') ] ,' '] 69 tag[ data[-1]['label'] ] 70 except IndexError: 71 raise FragmentError, 'An error has occured whilst building the breadcrumb trail. This usually occurs when a content template has a breadcrumb trail renderer but the parent nav.yml does not include a reference to the current templates directory. Use -V to find out more information about which page cause this error.' 72 63 73 return tag 64 74
