[gen] Various bugfixes.

This commit is contained in:
Gaetan Delannay 2013-04-16 19:56:47 +02:00
parent fb40913ef5
commit 0a8e06f1d9
4 changed files with 7 additions and 5 deletions

View file

@ -131,7 +131,7 @@
<tal:comment replace="nothing">The title of the search.</tal:comment> <tal:comment replace="nothing">The title of the search.</tal:comment>
<p> <p>
<span tal:replace="searchDescr/translated"/> <span tal:replace="structure searchDescr/translated"/>
(<span tal:replace="totalNumber"/>) (<span tal:replace="totalNumber"/>)
<tal:newSearch condition="python: showNewSearch and (searchName == 'customSearch')"> <tal:newSearch condition="python: showNewSearch and (searchName == 'customSearch')">
&nbsp;&mdash;&nbsp;<i><a tal:attributes="href newSearchUrl" &nbsp;&mdash;&nbsp;<i><a tal:attributes="href newSearchUrl"

View file

@ -96,7 +96,9 @@ class AbstractWrapper(object):
elif name == 'tool': return self.o.getTool().appy() elif name == 'tool': return self.o.getTool().appy()
elif name == 'request': elif name == 'request':
# The request may not be present, ie if we are at Zope startup. # The request may not be present, ie if we are at Zope startup.
return getattr(self.o, 'REQUEST', None) res = getattr(self.o, 'REQUEST', None)
if res != None: return res
return self.o.getProductConfig().fakeRequest
elif name == 'session': return self.o.REQUEST.SESSION elif name == 'session': return self.o.REQUEST.SESSION
elif name == 'typeName': return self.__class__.__bases__[-1].__name__ elif name == 'typeName': return self.__class__.__bases__[-1].__name__
elif name == 'id': return self.o.id elif name == 'id': return self.o.id
@ -193,7 +195,7 @@ class AbstractWrapper(object):
root object in the application folder.''' root object in the application folder.'''
isField = isinstance(fieldNameOrClass, basestring) isField = isinstance(fieldNameOrClass, basestring)
tool = self.tool.o tool = self.tool.o
# Determine the portal type of the object to create # Determine the class of the object to create
if isField: if isField:
fieldName = fieldNameOrClass fieldName = fieldNameOrClass
appyType = self.o.getAppyType(fieldName) appyType = self.o.getAppyType(fieldName)

View file

@ -266,7 +266,7 @@ def formatNumber(n, sep=',', precision=2, tsep=' '):
try: try:
decPart = int(splitted[1]) decPart = int(splitted[1])
if decPart != 0: if decPart != 0:
res += sep + str(decPart) res += sep + splitted[1]
except ValueError: except ValueError:
# This exception may occur when the float value has an "exp" # This exception may occur when the float value has an "exp"
# part, like in this example: 4.345e-05 # part, like in this example: 4.345e-05