[gen] Optimized PXs. [px] added tag 'var2', similar to 'var', but that is executed after tags 'for' and 'if'.

This commit is contained in:
Gaetan Delannay 2013-07-15 11:23:29 +02:00
parent 73c3cfb2c7
commit 1810373304
18 changed files with 834 additions and 956 deletions

View file

@ -105,6 +105,17 @@ class ToolMixin(BaseMixin):
podField = self.getAppyType(name, className=obj.meta_type)
return podField.getToolInfo(obj.appy())
def getImageUrl(self, name, bg=False):
'''Gets the full URL of an image named p_name. If p_bg is False, the URL
is meant to be used as content for an img's "src" attribute. If p_bg
is True, the URL is meant to be used in a "style" attribute for
defining the background image of the current tag.'''
# If not extension is found in the image p_name, suppose it is a png.
if '.' not in name: name += '.png'
url = '%s/ui/%s' % (self.getPhysicalRoot(),absolute_url(), name)
if not bg: return url
return 'background-image: url(%s)' % url
def generateDocument(self):
'''Generates the document from field-related info. UID of object that
is the template target is given in the request.'''