[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>
<p>
<span tal:replace="searchDescr/translated"/>
<span tal:replace="structure searchDescr/translated"/>
(<span tal:replace="totalNumber"/>)
<tal:newSearch condition="python: showNewSearch and (searchName == 'customSearch')">
&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 == 'request':
# 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 == 'typeName': return self.__class__.__bases__[-1].__name__
elif name == 'id': return self.o.id
@ -193,7 +195,7 @@ class AbstractWrapper(object):
root object in the application folder.'''
isField = isinstance(fieldNameOrClass, basestring)
tool = self.tool.o
# Determine the portal type of the object to create
# Determine the class of the object to create
if isField:
fieldName = fieldNameOrClass
appyType = self.o.getAppyType(fieldName)

View file

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