Commit 41be01e2 authored by Hanno Schlichting's avatar Hanno Schlichting

Merged r128118:128120 from 2.13 branch

parent 832ddf16
......@@ -269,7 +269,6 @@ class PropertyManager(Base):
dict[p['id']]=p
return dict
# Web interface
security.declareProtected(manage_properties, 'manage_addProperty')
......@@ -279,7 +278,7 @@ class PropertyManager(Base):
Sets a new property with the given id, type, and value.
"""
if type in type_converters:
value=type_converters[type](value)
value = type_converters[type](value)
self._setProperty(id.strip(), value, type)
if REQUEST is not None:
return self.manage_propertiesForm(self, REQUEST)
......@@ -294,16 +293,16 @@ class PropertyManager(Base):
instead for most situations.
"""
for prop in self._propertyMap():
name=prop['id']
name = prop['id']
if 'w' in prop.get('mode', 'wd'):
if prop['type'] == 'multiple selection':
value=REQUEST.get(name, [])
value = REQUEST.form.get(name, [])
else:
value=REQUEST.get(name, '')
value = REQUEST.form.get(name, '')
self._updateProperty(name, value)
if REQUEST:
message="Saved changes."
return self.manage_propertiesForm(self,REQUEST,
message = "Saved changes."
return self.manage_propertiesForm(self, REQUEST,
manage_tabs_message=message)
security.declareProtected(manage_properties, 'manage_changeProperties')
......@@ -314,20 +313,23 @@ class PropertyManager(Base):
name=value parameters
"""
if REQUEST is None:
props={}
else: props=REQUEST
props = {}
elif isinstance(REQUEST, dict):
props = REQUEST
else:
props = REQUEST.form
if kw:
for name, value in kw.items():
props[name]=value
propdict=self.propdict()
props[name] = value
propdict = self.propdict()
for name, value in props.items():
if self.hasProperty(name):
if not 'w' in propdict[name].get('mode', 'wd'):
raise BadRequest, '%s cannot be changed' % escape(name)
raise BadRequest('%s cannot be changed' % escape(name))
self._updateProperty(name, value)
if REQUEST:
message="Saved changes."
return self.manage_propertiesForm(self,REQUEST,
message = "Saved changes."
return self.manage_propertiesForm(self, REQUEST,
manage_tabs_message=message)
# Note - this is experimental, pending some community input.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment