diff options
author | Gunnar Wrobel <wrobel@gentoo.org> | 2006-05-15 07:26:38 +0000 |
---|---|---|
committer | Gunnar Wrobel <wrobel@gentoo.org> | 2006-05-15 07:26:38 +0000 |
commit | 94e230abd6a14cdbe76c312d9461b058c9dc7385 (patch) | |
tree | 9debada012cc5245ae970ac94e71eac11fded92b /www-apps | |
parent | Forgot adding the digest (diff) | |
download | overlay-94e230abd6a14cdbe76c312d9461b058c9dc7385.tar.gz overlay-94e230abd6a14cdbe76c312d9461b058c9dc7385.tar.bz2 overlay-94e230abd6a14cdbe76c312d9461b058c9dc7385.zip |
Update to the blocks renderer
svn path=/stable/; revision=711
Diffstat (limited to 'www-apps')
-rw-r--r-- | www-apps/pyblosxom-plugins/Manifest | 2 | ||||
-rw-r--r-- | www-apps/pyblosxom-plugins/files/blocks.py | 93 |
2 files changed, 55 insertions, 40 deletions
diff --git a/www-apps/pyblosxom-plugins/Manifest b/www-apps/pyblosxom-plugins/Manifest index be3b774..1653ffc 100644 --- a/www-apps/pyblosxom-plugins/Manifest +++ b/www-apps/pyblosxom-plugins/Manifest @@ -1,4 +1,4 @@ -MD5 68900c82dbdf221d22e8a999b02443d9 files/blocks.py 5866 +MD5 e56518b49fbff23b7b862fde91e53105 files/blocks.py 6369 MD5 3d89ed013ed90e7afff11e8e3a57ebf4 files/comments.py 25302 MD5 eb4a14c8aae732ef13ba754014bbc30a files/contact.py 11493 MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-pyblosxom-plugins-1.3.2 0 diff --git a/www-apps/pyblosxom-plugins/files/blocks.py b/www-apps/pyblosxom-plugins/files/blocks.py index 4b583ba..6fac35a 100644 --- a/www-apps/pyblosxom-plugins/files/blocks.py +++ b/www-apps/pyblosxom-plugins/files/blocks.py @@ -33,32 +33,34 @@ def _update_config(config): # set this explicitly so it's available in templates config[TRIGGER_KEY] = TRIGGER + + class BlocksRenderer(Renderer): - def _processBlockContent(self): - """ - Processes the content for the story portion of a page. + def _setFlavour(self, path = ''): - @returns: the content string - @rtype: string - """ - config = self._request.getConfiguration() data = self._request.getData() + config = self._request.getConfiguration() + + try: + if path: + data['path_info'].append(path) + self.flavour = self._getFlavour(data.get("flavour", "html")) + + except NoSuchFlavourException, nsfe: + error_msg = nsfe._msg + try: + self.flavour = self._getFlavour("error") + except NoSuchFlavourException, nsfe2: + self.flavour = get_included_flavour("error") + error_msg = error_msg + "And your error flavour doesn't exist." + + self._content = { "title": "Flavour error", + "body": error_msg } + + if path: + data['path_info'] = data['path_info'][:-1] - if isinstance(self._content, list): - current_date = '' - - for block in self._content: - if self.flavour.has_key('block_head'): - self._outputFlavour(parsevars,'block_head') - outputbuffer = [] - for entry in block: - output, current_date = self._processEntry(entry, current_date) - outputbuffer.append(output) - self.write(u"".join(outputbuffer)) - if self.flavour.has_key('block_foot'): - self._outputFlavour(parsevars,'block_foot') - def render(self, header=1): """ Figures out flavours and such and then renders the content according @@ -79,19 +81,7 @@ class BlocksRenderer(Renderer): parsevars.update(config) parsevars.update(data) - try: - self.flavour = self._getFlavour(data.get("flavour", "html")) - - except NoSuchFlavourException, nsfe: - error_msg = nsfe._msg - try: - self.flavour = self._getFlavour("error") - except NoSuchFlavourException, nsfe2: - self.flavour = get_included_flavour("error") - error_msg = error_msg + "And your error flavour doesn't exist." - - self._content = { "title": "Flavour error", - "body": error_msg } + self._setFlavour() data['content-type'] = self.flavour['content_type'].strip() if header: @@ -99,13 +89,31 @@ class BlocksRenderer(Renderer): self.addHeader('Content-type', '%(content-type)s' % data) self.showHeaders() - + if self._content: if self.flavour.has_key('head'): self._outputFlavour(parsevars,'head') - self._processBlockContent() - if self.flavour.has_key('date_foot'): - self._outputFlavour(parsevars,'date_foot') + + if isinstance(self._content, list): + for block in self._content: + + current_date = '' + self.dayFlag = 1 + + self._setFlavour(block.get_path()) + + if self.flavour.has_key('block_head'): + self._outputFlavour({},'block_head') + outputbuffer = [] + for entry in block: + output, current_date = self._processEntry(entry, current_date) + outputbuffer.append(output) + self.write(u"".join(outputbuffer)) + if self.flavour.has_key('date_foot'): + self._outputFlavour(parsevars,'date_foot') + if self.flavour.has_key('block_foot'): + self._outputFlavour({},'block_foot') + if self.flavour.has_key('foot'): self._outputFlavour(parsevars,'foot') @@ -155,6 +163,12 @@ class Blocklist(list): return result return default + def set_path(self, path): + self.__path = path + + def get_path(self): + return self.__path + def cb_filelist(args): """ """ @@ -201,7 +215,8 @@ def cb_filelist(args): block = Blocklist() for i in valid_list: block.append(i) + block.set_path(category) blocklist.append(block) - + return blocklist |