Nuxeo mailing list archives
[Nuxeo-tickets] Re: [Nuxeo Repository] #1557: ZODBDirectory
schema/layout can't hold any type of fields inherited from file
widget/field
Nuxeo Repository
trac at nuxeo.com
Tue Oct 24 13:00:37 CEST 2006
#1557: ZODBDirectory schema/layout can't hold any type of fields inherited from
file widget/field
--------------------------+-------------------------------------------------
Reporter: div | Owner: fguillaume
Type: defect | Status: new
Priority: P1 | Milestone: CPS 3.4.3
Component: CPSDirectory | Version: 3.4.0
Severity: major | Resolution:
Keywords: |
--------------------------+-------------------------------------------------
Comment (by tracguest):
I had the same problem using images for directory entries and used the
patches, but I found a problem creating directory entries:
* TypeError: _getContentUrl() takes at least 3 arguments (2 given)
from getFileInfo() in PatchAddPhotoToLDAPMembers.py
I decided to modify the method getFileInfo to get the entry from the
directory and get the url of the image from the entry itself (the image
file is not stored in the ZODB so it is in the field 'image' within the
entry).
So, I changed:
...
# some adapters does not have _getContentUrl
if getattr(adapter, '_getContentUrl', None) is not None:
content_url = self._getContentUrl(entry_id, field_id)
...
for:
...
# some adapters does not have _getContentUrl
if getattr(adapter, '_getContentUrl', None) is not None:
dir = dm.getContext()
try:
entry = dir.getEntry(entry_id)
content_url = entry['image'].absolute_url()
except:
content_url = ''
...
and it worked.
Then I decided to implement a new widget for directory entries that
implemtents the patch functionality. It is called
"DirectoryEntryImageWidget". It just inherits from CPSImageWidget and
redefines the getFileInfo method. And it worked too.
I hope this "solution" could help.
--
Ticket URL: <http://svn.nuxeo.org/trac/pub/ticket/1557>
Nuxeo Repository <http://www.cps-project.org/>
Nuxeo Repository
This list archive provided by Nuxeo, the
leaders of open source ECM.
Check out the Nuxeo 5 open source,
standards-based ECM project.