[gen] Added attribute 'xml' on every field allowing to customize the XML marshalling process. [gen] Added new layout 'xml', now different from the 'view' layout, allowing to define which fields are to be dumped in the XML version of some object. [gen] Security fix in ToolMixin::getUser. [gen] Bugfix in Mixin::getUrl. [shared] dav.py: method 'get' can now accept parameters. [shared] xml_parser: changes to the XmlMarshaller (due to XML-related changes).
This commit is contained in:
parent
f055ec1754
commit
c53654a1a1
19 changed files with 119 additions and 80 deletions
|
@ -528,7 +528,7 @@ class Ref(Field):
|
|||
checkboxes=True, checkboxesDefault=None, sdefault='',
|
||||
scolspan=1, swidth=None, sheight=None, sselect=None,
|
||||
persist=True, render='list', menuIdMethod=None,
|
||||
menuInfoMethod=None, menuUrlMethod=None):
|
||||
menuInfoMethod=None, menuUrlMethod=None, xml=None):
|
||||
self.klass = klass
|
||||
self.attribute = attribute
|
||||
# May the user add new objects through this ref ? "add" may also contain
|
||||
|
@ -708,7 +708,7 @@ class Ref(Field):
|
|||
specificReadPermission, specificWritePermission, width,
|
||||
height, None, colspan, master, masterValue, focus,
|
||||
historized, mapping, label, sdefault, scolspan, swidth,
|
||||
sheight, persist)
|
||||
sheight, persist, xml)
|
||||
self.validable = bool(self.link)
|
||||
self.checkParameters()
|
||||
|
||||
|
@ -794,6 +794,12 @@ class Ref(Field):
|
|||
# Return a copy: it can be dangerous to give the real database value.
|
||||
if res: return list(res)
|
||||
|
||||
def getXmlValue(self, obj, value):
|
||||
'''The default XML value for a Ref is the list of tied object URLs.'''
|
||||
# Bypass the default behaviour if a custom method is given
|
||||
if self.xml: return self.xml(obj, value)
|
||||
return ['%s/xml' % tied.o.absolute_url() for tied in value]
|
||||
|
||||
def getPossibleValues(self, obj, startNumber=None, someObjects=False,
|
||||
removeLinked=False):
|
||||
'''This method returns the list of all objects that can be selected
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue