"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Cheetah/Tools/SiteHierarchy.py" between
cheetah3-3.1.0.tar.gz and cheetah3-3.2.0.tar.gz

About: Cheetah3 is a template engine and code generation tool for e.g. for Web development or Java, SQL, LaTeX, form email ... (written in Python).

SiteHierarchy.py  (cheetah3-3.1.0):SiteHierarchy.py  (cheetah3-3.2.0)
skipping to change at line 94 skipping to change at line 94
return self.emptyCrumb() return self.emptyCrumb()
return self.crumbSeperator().join( return self.crumbSeperator().join(
map(lambda x, self=self: self.crumbLink(x[0], x[1]), path)) + \ map(lambda x, self=self: self.crumbLink(x[0], x[1]), path)) + \
self.crumbTerminator() self.crumbTerminator()
# Methods to control the Aesthetics # Methods to control the Aesthetics
# - override these methods for your own look # - override these methods for your own look
def menuLink(self, url, text, indent): def menuLink(self, url, text, indent):
if url == self._currentURL or self._prefix + url == self._currentURL: if url == self._currentURL or self._prefix + url == self._currentURL:
return '%s<B%s>%s</B> <BR>\n' % ('&nbsp;'*2*indent, return '%s<B%s>%s</B> <BR>\n' % ('&nbsp;' * 2 * indent,
self._menuCSSClass, text) self._menuCSSClass, text)
else: else:
return '%s<A HREF="%s%s"%s>%s</A> <BR>\n' % \ return '%s<A HREF="%s%s"%s>%s</A> <BR>\n' % \
('&nbsp;'*2*indent, self._prefix, url, ('&nbsp;'*2*indent, self._prefix, url, # noqa: E226,E501 mis sing whitespace around operator
self._menuCSSClass, text) self._menuCSSClass, text)
def crumbLink(self, url, text): def crumbLink(self, url, text):
if url == self._currentURL or self._prefix + url == self._currentURL: if url == self._currentURL or self._prefix + url == self._currentURL:
return '<B%s>%s</B>' % (self._crumbCSSClass, text) return '<B%s>%s</B>' % (self._crumbCSSClass, text)
else: else:
return '<A HREF="%s%s"%s>%s</A>' % \ return '<A HREF="%s%s"%s>%s</A>' % \
(self._prefix, url, self._crumbCSSClass, text) (self._prefix, url, self._crumbCSSClass, text)
def crumbSeperator(self): def crumbSeperator(self):
skipping to change at line 130 skipping to change at line 130
def _menubarRecurse(self, contents, indent, stream): def _menubarRecurse(self, contents, indent, stream):
if isinstance(contents, tuple): if isinstance(contents, tuple):
url, text = contents url, text = contents
rest = [] rest = []
else: else:
url, text = contents[0] url, text = contents[0]
rest = contents[1:] rest = contents[1:]
stream.write(self.menuLink(url, text, indent)) stream.write(self.menuLink(url, text, indent))
if self._inContents(contents): if self._inContents(contents):
for item in rest: for item in rest:
self._menubarRecurse(item, indent+1, stream) self._menubarRecurse(item, indent + 1, stream)
def _inContents(self, contents): def _inContents(self, contents):
if isinstance(contents, tuple): if isinstance(contents, tuple):
return self._currentURL == contents[0] return self._currentURL == contents[0]
for item in contents: for item in contents:
if self._inContents(item): if self._inContents(item):
return True return True
return False return False
################################################## ##################################################
# from the command line # from the command line
skipping to change at line 155 skipping to change at line 155
('/about', 'About Us'), ('/about', 'About Us'),
[('/services', 'Services'), [('/services', 'Services'),
[('/services/products', 'Products'), [('/services/products', 'Products'),
('/services/products/widget', 'The Widget'), ('/services/products/widget', 'The Widget'),
('/services/products/wedge', 'The Wedge'), ('/services/products/wedge', 'The Wedge'),
('/services/products/thimble', 'The Thimble'), ('/services/products/thimble', 'The Thimble'),
], ],
('/services/prices', 'Prices'), ('/services/prices', 'Prices'),
], ],
('/contact', 'Contact Us'), ('/contact', 'Contact Us'),
] ]
for url in ['/', '/services', '/services/products/widget', '/contact']: for url in ['/', '/services', '/services/products/widget', '/contact']:
print('<p>', '='*50) print('<p>', '='*50) # noqa: E226 missing whitespace around operator
print('<br> %s: <br>\n' % url) print('<br> %s: <br>\n' % url)
n = Hierarchy(hierarchy, url, menuCSSClass='menu', n = Hierarchy(hierarchy, url, menuCSSClass='menu',
crumbCSSClass='crumb', prefix='/here') crumbCSSClass='crumb', prefix='/here')
print(n.menuList()) print(n.menuList())
print('<p>', '-'*50) print('<p>', '-'*50) # noqa: E226 missing whitespace around operator
print(n.crumbs()) print(n.crumbs())
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)