appy.gen: bugfixes.
This commit is contained in:
parent
7b0b7e147d
commit
0dd8b72dca
|
@ -36,4 +36,6 @@ class Object:
|
|||
res += u'%s=<encoding problem> ' % attrName
|
||||
res = res.strip() + '>'
|
||||
return res.encode('utf-8')
|
||||
def __nonzero__(self):
|
||||
return bool(self.__dict__)
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -1346,21 +1346,19 @@ class String(Type):
|
|||
return value
|
||||
|
||||
def getStorableValue(self, value):
|
||||
if not self.isEmptyValue(value) and (self.transform != 'none'):
|
||||
if isinstance(value, basestring):
|
||||
return self.applyTransform(value)
|
||||
else:
|
||||
return [self.applyTransform(v) for v in value]
|
||||
return value
|
||||
|
||||
def store(self, obj, value):
|
||||
if self.isMultiValued() and isinstance(value, basestring):
|
||||
value = [value]
|
||||
isString = isinstance(value, basestring)
|
||||
# Apply transform if required
|
||||
if isString and not self.isEmptyValue(value) and \
|
||||
(self.transform != 'none'):
|
||||
value = self.applyTransform(value)
|
||||
# Truncate the result if longer than self.maxChars
|
||||
if self.maxChars and isinstance(value, basestring) and \
|
||||
(len(value) > self.maxChars):
|
||||
if isString and self.maxChars and (len(value) > self.maxChars):
|
||||
value = value[:self.maxChars]
|
||||
exec 'obj.%s = value' % self.name
|
||||
# Get a multivalued value if required.
|
||||
if value and self.isMultiValued() and \
|
||||
(type(value) not in sequenceTypes):
|
||||
value = [value]
|
||||
return value
|
||||
|
||||
def getIndexType(self):
|
||||
'''Index type varies depending on String parameters.'''
|
||||
|
|
|
@ -192,7 +192,7 @@ toolFieldPrefixes = ('defaultValue', 'podTemplate', 'formats', 'resultColumns',
|
|||
defaultToolFields = ('title', 'users', 'groups', 'translations',
|
||||
'enableNotifications', 'unoEnabledPython','openOfficePort',
|
||||
'numberOfResultsPerPage', 'listBoxesMaximumWidth',
|
||||
'appyVersion', 'refreshSecurity')
|
||||
'appyVersion')
|
||||
|
||||
class Tool(ModelClass):
|
||||
# In a ModelClass we need to declare attributes in the following list.
|
||||
|
@ -207,8 +207,6 @@ class Tool(ModelClass):
|
|||
numberOfResultsPerPage = gen.Integer(default=30)
|
||||
listBoxesMaximumWidth = gen.Integer(default=100)
|
||||
appyVersion = gen.String(show=False, layouts='f')
|
||||
def refreshSecurity(self): pass # Real method in the wrapper
|
||||
refreshSecurity = gen.Action(action=refreshSecurity, confirm=True)
|
||||
# Ref(User) will maybe be transformed into Ref(CustomUserClass).
|
||||
users = gen.Ref(User, multiplicity=(0,None), add=True, link=False,
|
||||
back=gen.Ref(attribute='toTool', show=False),
|
||||
|
|
|
@ -502,7 +502,7 @@ function updateRowNumber(row, rowIndex, action) {
|
|||
with new p_rowIndex. If p_action is 'set', p_rowIndex becomes the new
|
||||
index. If p_action is 'add', new index becomes:
|
||||
existing index + p_rowIndex. */
|
||||
var tagTypes = ['input', 'select', 'img'];
|
||||
var tagTypes = ['input', 'select', 'img', 'textarea'];
|
||||
var currentIndex = -1;
|
||||
for (var i=0; i < tagTypes.length; i++) {
|
||||
var widgets = row.getElementsByTagName(tagTypes[i]);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<tal:comment replace="nothing">Single row.</tal:comment>
|
||||
<tr metal:define-macro="row"
|
||||
<tr metal:define-macro="row" valign="top"
|
||||
tal:attributes="style python: (rowIndex==-1) and 'display: none' or ''">
|
||||
<td align="center" tal:repeat="fieldInfo widget/fieldsd">
|
||||
<tal:show define="widget python: fieldInfo[1];
|
||||
|
|
|
@ -133,5 +133,4 @@ class ToolWrapper(AbstractWrapper):
|
|||
expression="ctx['nb'] += int(obj.o.refreshSecurity())")
|
||||
msg = 'Security refresh: %d object(s) updated.' % context['nb']
|
||||
self.log(msg)
|
||||
self.say(msg)
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue