[pod,px] 'loop' variable allows to know if we are managing an even or odd elem via loop.<elem>.odd and loop.<elem>.even. [gen] In the process of migrating from ZPT (Zope Page Templates) to appy.px (Python Xml).

This commit is contained in:
Gaetan Delannay 2013-06-27 11:57:39 +02:00
parent e6cacd10dd
commit cb6fea7631
6 changed files with 595 additions and 35 deletions

View file

@ -44,6 +44,11 @@ class ToolMixin(BaseMixin):
tool = self.appy()
return tool.pxHome({'self': tool})
def query(self):
'''Returns the content of px ToolWrapper.pxQuery.'''
tool = self.appy()
return tool.pxQuery({'self': tool})
def getHomePage(self):
'''Return the home page when a user hits the app.'''
# If the app defines a method "getHomePage", call it.
@ -452,9 +457,9 @@ class ToolMixin(BaseMixin):
'''Guess the current layout type, according to actual URL.'''
actualUrl = self.REQUEST['ACTUAL_URL']
res = ''
if actualUrl.endswith('/ui/view'):
if actualUrl.endswith('/view'):
res = 'view'
elif actualUrl.endswith('/ui/edit') or actualUrl.endswith('/do'):
elif actualUrl.endswith('/edit') or actualUrl.endswith('/do'):
res = 'edit'
return res

View file

@ -203,6 +203,16 @@ class BaseMixin:
obj = createObject(tool.getPath('/temp_folder'), id, className, appName)
return self.goto(obj.getUrl(**urlParams))
def view(self):
'''Returns the view PX.'''
appySelf = self.appy()
return appySelf.pxView({'self': appySelf})
def edit(self):
'''Returns the edit PX.'''
appySelf = self.appy()
return appySelf.pxEdit({'self': appySelf})
def setLock(self, user, page):
'''A p_user edits a given p_page on this object: we will set a lock, to
prevent other users to edit this page at the same time.'''