[gen] Goodbye Zope Page Templates.

This commit is contained in:
Gaetan Delannay 2013-08-21 22:25:27 +02:00
parent 1bd77d68c4
commit 04852360fa
46 changed files with 102 additions and 3173 deletions

View file

@ -185,8 +185,8 @@ class ToolWrapper(AbstractWrapper):
<div class="portletContent"
var="searchInfo=ztool.getGroupedSearches(rootClass)">
<div class="portletTitle">
<a var="queryParam=searchInfo['default'] and \
searchInfo['default']['name'] or ''"
<a var="queryParam=searchInfo.default and \
searchInfo.default.name or ''"
href=":'%s?className=%s&amp;search=%s' % \
(queryUrl,rootClass,queryParam)"
class=":(not currentSearch and (currentClass==rootClass) and \
@ -246,9 +246,9 @@ class ToolWrapper(AbstractWrapper):
</x>
<!-- Predefined searches -->
<x for="widget in searchInfo['searches']">
<x if="widget['type']=='group'">:widget['px']</x>
<x if="widget['type']!='group'" var2="search=widget">:search['px']</x>
<x for="search in searchInfo.searches">
<x if="search.type == 'group'">:search.px</x>
<x if="search.type != 'group'">:search.pxView</x>
</x>
</div>
</x>
@ -285,29 +285,29 @@ class ToolWrapper(AbstractWrapper):
# will be the object whose page is shown; if the layouted object is a field,
# the layout target will be this field.
pxLayoutedObject = Px('''
<table var="layoutCss=layout['css_class'];
<table var="layoutCss=layout.css_class;
isCell=layoutType == 'cell'"
cellpadding=":layout['cellpadding']"
cellspacing=":layout['cellspacing']"
width=":not isCell and layout['width'] or ''"
cellpadding=":layout.cellpadding"
cellspacing=":layout.cellspacing"
width=":not isCell and layout.width or ''"
align=":not isCell and \
ztool.flipLanguageDirection(layout['align'], dir) or ''"
ztool.flipLanguageDirection(layout.align, dir) or ''"
class=":tagCss and ('%s %s' % (tagCss, layoutCss)).strip() or \
layoutCss"
style=":layout['style']" id=":tagId" name=":tagName">
style=":layout.style" id=":tagId" name=":tagName">
<!-- The table header row -->
<tr if="layout['headerRow']" valign=":layout['headerRow']['valign']">
<th for="cell in layout['headerRow']['cells']" width=":cell['width']"
align=":ztool.flipLanguageDirection(cell['align'], dir)">
<tr if="layout.headerRow" valign=":layout.headerRow.valign">
<th for="cell in layout.headerRow.cells" width=":cell.width"
align=":ztool.flipLanguageDirection(cell.align, dir)">
</th>
</tr>
<!-- The table content -->
<tr for="row in layout['rows']" valign=":row['valign']">
<td for="cell in row['cells']" colspan=":cell['colspan']"
align=":ztool.flipLanguageDirection(cell['align'], dir)"
<tr for="row in layout.rows" valign=":row.valign">
<td for="cell in row.cells" colspan=":cell.colspan"
align=":ztool.flipLanguageDirection(cell.align, dir)"
class=":not loop.cell.last and 'cellGap' or ''">
<x for="pxName in cell['content']">
<x for="pxName in cell.content">
<x var="px=(pxName == '?') and 'px%s' % layoutType.capitalize() \
or pxName">:getattr(layoutTarget, px)</x>
<img if="not loop.pxName.last" src=":url('space.gif')"/>
@ -423,9 +423,9 @@ class ToolWrapper(AbstractWrapper):
remember=True, sortBy=sortKey, sortOrder=sortOrder, \
filterKey=filterKey, filterValue=filterValue, \
refObject=refObject, refField=refField);
zobjects=queryResult['objects'];
totalNumber=queryResult['totalNumber'];
batchSize=queryResult['batchSize'];
zobjects=queryResult.objects;
totalNumber=queryResult.totalNumber;
batchSize=queryResult.batchSize;
batchNumber=len(zobjects);
ajaxHookId='queryResult';
navBaseCall='askQueryResult(%s,%s,%s,%s,**v**)' % \

View file

@ -69,9 +69,9 @@ class AbstractWrapper(object):
<x for="bc in breadcrumb" var2="nb=loop.bc.nb">
<img if="nb != 0" src=":url('to')"/>
<!-- Display only the title of the current object -->
<span if="nb == len(breadcrumb)-1">:bc['title']</span>
<span if="nb == len(breadcrumb)-1">:bc.title</span>
<!-- Display a link for parent objects -->
<a if="nb != len(breadcrumb)-1" href=":bc['url']">:bc['title']</a>
<a if="nb != len(breadcrumb)-1" href=":bc.url">:bc.title</a>
</x>
</td>
<!-- Object navigation -->
@ -292,9 +292,9 @@ class AbstractWrapper(object):
startNumber=int(startNumber);
batchSize=int(req.get('maxPerPage', 5));
historyInfo=zobj.getHistory(startNumber,batchSize=batchSize)"
if="historyInfo['events']"
var2="objs=historyInfo['events'];
totalNumber=historyInfo['totalNumber'];
if="historyInfo.events"
var2="objs=historyInfo.events;
totalNumber=historyInfo.totalNumber;
ajaxHookId='appyHistory';
navBaseCall='askObjectHistory(%s,%s,%d,**v**)' % \
(q(ajaxHookId), q(zobj.absolute_url()), batchSize)">
@ -516,7 +516,7 @@ class AbstractWrapper(object):
<!-- Refresh -->
<td if="zobj.isDebug()">
<a href="zobj.getUrl(mode=layoutType, page=page, refresh='yes')">
<a href=":zobj.getUrl(mode=layoutType, page=page, refresh='yes')">
<img title="Refresh" style="vertical-align:top" src=":url('refresh')"/>
</a>
</td>
@ -525,7 +525,7 @@ class AbstractWrapper(object):
# Displays the fields of a given page for a given object.
pxFields = Px('''
<table width=":layout['width']">
<table width=":layout.width">
<tr for="field in groupedFields">
<td if="field.type == 'group'">:field.pxView</td>
<td if="field.type != 'group'">:field.pxRender</td>
@ -911,7 +911,7 @@ class AbstractWrapper(object):
# returned by method executeResult.
res = tool.executeQuery(contentType, search=search,
maxResults=maxResults, noSecurity=noSecurity)
return [o.appy() for o in res['objects']]
return [o.appy() for o in res.objects]
def search1(self, *args, **kwargs):
'''Identical to m_search above, but returns a single result (if any).'''