Ticket #1557 (new defect)

Opened 3 years ago

Last modified 3 years ago

ZODBDirectory schema/layout can't hold any type of fields inherited from file widget/field

Reported by: div Assigned to: fguillaume
Priority: P1 Milestone: CPS 3.5.0
Component: CPSDirectory Version: 3.4.0
Severity: major Keywords:
Cc:

Description

ZODBDirectory schema/layout can't hold any type of fields inherited from file widget/field because ZODBDirectoryEntry is not able to hold objects.

Attachments

PatchPhotoInMemberData.rar (4.4 kB) - added by tracguest on 05/22/06 14:33:26.
patch for photo on member data
PatchesAddPhotoToMembers.2.zip (4.8 kB) - added by tracguest on 05/22/06 15:41:37.
PatchesAddPhotoToMembers.zip (4.8 kB) - added by tracguest on 05/22/06 15:41:38.

Change History

03/23/06 17:51:52 changed by div

  • severity changed from normal to major.
  • milestone changed from unspecified to CPS 3.4.1.

03/24/06 17:04:03 changed by fguillaume

What's the traceback? Would fixing the storage adapter to store always as simple attributes be enough?

03/27/06 10:57:41 changed by div

Traceback:

  Module ZPublisher.Publish, line 114, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 40, in call_object
  Module Shared.DC.Scripts.Bindings, line 311, in __call__
  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
  Module Products.CMFCore.FSPageTemplate, line 195, in _exec
  Module Products.CMFCore.FSPageTemplate, line 134, in pt_render
  Module Products.PageTemplates.PageTemplate, line 104, in pt_render
<FSPageTemplate at /cps/cpsdirectory_entry_edit_form>
  Module TAL.TALInterpreter, line 238, in __call__
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 507, in do_setLocal_tal
  Module Products.PageTemplates.TALES, line 221, in evaluate

URL: file:eBAT/skins/ebat_directory/cpsdirectory_entry_edit_form.pt
Line 1, Column 0

Expression: <PythonExpr dir.renderEditEntryDetailed(id, request=edit_request)>
Names:
{'container': <CPSDefaultSite at /cps>,
 'context': <CPSDefaultSite at /cps>,
 'default': <Products.PageTemplates.TALES.Default instance at 0xb755d20c>,
 'here': <CPSDefaultSite at /cps>,
 'loop': <Products.PageTemplates.TALES.SafeMapping object at 0xb302268c>,
 'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0xb74fdcac>,
 'nothing': None,
 'options': {'args': ()},
 'repeat': <Products.PageTemplates.TALES.SafeMapping object at 0xb302268c>,
 'request': <HTTPRequest, URL=http://localhost:9080/cps/cpsdirectory_entry_edit_form>,
 'root': <Application at >,
 'template': <FSPageTemplate at /cps/cpsdirectory_entry_edit_form>,
 'traverse_subpath': [],
 'user': <CPSUser manager.manager@e-bat.org>}

  Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
__traceback_info__: dir.renderEditEntryDetailed(id, request=edit_request)
  Module Python expression "dir.renderEditEntryDetailed(id, request=edit_request)", line 1, in <expression>
  Module Products.CPSDirectory.BaseDirectory, line 611, in renderEditEntryDetailed
  Module Products.CPSDirectory.BaseDirectory, line 932, in _renderLayout
  Module Products.CPSSchemas.Layout, line 391, in renderLayoutStructure
  Module Products.CPSSchemas.BasicWidgets, line 1778, in render
  Module Products.CPSSchemas.BasicWidgets, line 1613, in getFileInfo
TypeError: _getContentUrl() takes exactly 4 arguments (3 given)

ZODBDirectory use as an adapter the AttributeStorageAdapter?, which seems to not offer all the needed functionality.

05/19/06 17:05:02 changed by sfermigier

  • milestone changed from CPS 3.4.1 to CPS 3.4.2.

05/22/06 14:32:10 changed by tracguest

  • type changed from defect to enhancement.

Patch to add a photo on member data, works with or without LDAP feature.

05/22/06 14:33:26 changed by tracguest

  • attachment PatchPhotoInMemberData.rar added.

patch for photo on member data

05/22/06 14:42:10 changed by ogrisel

  • type changed from enhancement to defect.

05/22/06 15:31:30 changed by tracguest

The rar attachment is not complete

05/22/06 15:41:37 changed by tracguest

  • attachment PatchesAddPhotoToMembers.2.zip added.

05/22/06 15:41:38 changed by tracguest

  • attachment PatchesAddPhotoToMembers.zip added.

10/24/06 13:00:37 changed 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 = entryimage?.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.