Skip to content
Browse files

Merge pull request #2 from plone/davisagli-adjustments

A few adjustments to make it easier to use tiles without Deco
  • Loading branch information...
2 parents 51b9253 + cbb18c7 commit e12f1d1a2bb007b68cb4ffd57ae33e75d99938a6 @garbas garbas committed Feb 3, 2012
Showing with 7 additions and 12 deletions.
  1. +4 −4 plone/app/blocks/tiles.py
  2. +0 −3 plone/app/blocks/transform.py
  3. +3 −5 plone/app/blocks/utils.py
View
8 plone/app/blocks/tiles.py
@@ -28,21 +28,21 @@ def renderTiles(request, tree):
baseURL = request.getURL()
for tileNode in utils.headTileXPath(tree):
- tileHref = urljoin(baseURL, tileNode.attrib['data-tile'])
+ tileHref = urljoin(baseURL, tileNode.attrib[utils.tileAttrib])
tileTree = utils.resolve(tileHref)
if tileTree is not None:
tileRoot = tileTree.getroot()
- utils.replace_with_children(tileNode, tileRoot.find('head'))
+ utils.replace_content(tileNode, tileRoot.find('head'))
for tileNode in utils.bodyTileXPath(tree):
- tileHref = urljoin(baseURL, tileNode.attrib['data-tile'])
+ tileHref = urljoin(baseURL, tileNode.attrib[utils.tileAttrib])
tileTree = utils.resolve(tileHref)
if tileTree is not None:
tileRoot = tileTree.getroot()
tileHead = tileRoot.find('head')
if tileHead is not None:
for tileHeadChild in tileHead:
headNode.append(tileHeadChild)
- utils.replace_with_children(tileNode, tileRoot.find('body'))
+ utils.replace_content(tileNode, tileRoot.find('body'))
return tree
View
3 plone/app/blocks/transform.py
@@ -149,9 +149,6 @@ def transformIterable(self, result, encoding):
not isinstance(result, XMLSerializer):
return None
- if not self.request.get('plone.app.blocks.merged', False):
- return None
-
result.tree = tiles.renderTiles(self.request, result.tree)
return result
View
8 plone/app/blocks/utils.py
@@ -1,7 +1,4 @@
import logging
-import uuid
-
-from urlparse import urljoin
from lxml import etree
from lxml import html
@@ -26,8 +23,9 @@
headXPath = etree.XPath("/html/head")
layoutAttrib = 'data-layout'
layoutXPath = etree.XPath("/html/@" + layoutAttrib)
-headTileXPath = etree.XPath("/html/head//*[@data-tile]")
-bodyTileXPath = etree.XPath("/html/body//*[@data-tile]")
+tileAttrib = 'data-tile'
+headTileXPath = etree.XPath("/html/head//*[@" + tileAttrib + "]")
+bodyTileXPath = etree.XPath("/html/body//*[@" + tileAttrib + "]")
panelXPath = etree.XPath("//*[@data-panel]")
logger = logging.getLogger('plone.app.blocks')

0 comments on commit e12f1d1

Please sign in to comment.
Something went wrong with that request. Please try again.