Nuxeo mailing list archives
[Nuxeo-tickets] [Nuxeo Repository] #1863: Problem with
getIdAndTitle of DirectoryWidgets
Nuxeo Repository
trac at nuxeo.com
Tue Nov 20 12:02:45 CET 2007
#1863: Problem with getIdAndTitle of DirectoryWidgets
--------------------------+-------------------------------------------------
Reporter: tracguest | Owner: madarche
Type: defect | Status: new
Priority: P2 | Milestone:
Component: CPS (global) | Version: 3.4.3
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
Description : cette méthode renvoie l'erreur attributeError:
getEntryByDN(value). En effet getEntryByDN() n'exite plus elle est
remplacée par la méthode getEntry(). Voici le patch :
{{{
def adie_getIdAndTitle(self, value):
"""Get id and title from an entry value.
Returns a tuple (id, title), or None, None if the
entry could not be found.
"""
portal_directories = getToolByName(self, 'portal_directories')
dir = getattr(portal_directories, self.directory)
# If value is None or empty, do not query directories
if not value:
id = None
title = None
else:
if self.entry_type == 'id':
id = value
try:
title = dir.getEntry(id,
default=None)[dir.title_field]
except (IndexError, ValueError, KeyError, TypeError,
AttributeError):
title = None
else: # entry_type == 'dn':
try:
entry = dir.getEntry(value)
except (IndexError, ValueError, KeyError):
id = None
title = None
else:
id = None
title = entry[dir.title_field]
return (id, title)
from Products.CPSDirectory.DirectoryWidgets import EntryMixin
EntryMixin.getIdAndTitle = adie_getIdAndTitle
}}}
--
Ticket URL: <https://svn.nuxeo.org/trac/pub/ticket/1863>
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.