Ticket #1863 (new defect)

Opened 12 years ago

Problem with getIdAndTitle of DirectoryWidgets

Reported by: tracguest Owned by: madarche
Priority: P2 Milestone:
Component: CPS (global) Version: 3.4.3
Severity: normal Keywords:
Cc:

Description

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

Attachments

DirectoryWidgetsPatch.py Download (2.6 KB) - added by tracguest 12 years ago.

Change History

Changed 12 years ago by tracguest

Note: See TracTickets for help on using tickets.