[Zope-dev] Patch for CMFActionIcons: make edit work if icon expr is empty

Joachim Bauch jojo at struktur.de
Tue Apr 20 07:03:32 EDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

as it's possible to create an action icon with an empty icon expression, but
this action icon can never be edited again (a KeyError is raised), I propose
the attached patch against ActionIconsTool.py

After applying this patch, you can edit the empty action icons.

Greetings,
Joachim

- --
Joachim Bauch, struktur AG
Download icoya OpenContent 1.3 for FREE!    visit http://www.icoya.de/iOC4free <-
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAhQOEvb5cTc087cURAtUzAJ9Ao39VsNjyDgR7pXY0AMlQPZ67zQCgzt4v
By3VjMoZ1bp+a6LELYHNxSg=
=nPyP
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: ActionIconsTool.py
===================================================================
RCS file: /cvs-repository/Products/CMFActionIcons/ActionIconsTool.py,v
retrieving revision 1.2
diff -c -r1.2 ActionIconsTool.py
*** ActionIconsTool.py	13 Jul 2003 01:55:30 -0000	1.2
--- ActionIconsTool.py	20 Apr 2004 10:58:02 -0000
***************
*** 185,191 ****
  
      security.declareProtected( View, 'queryActionIcon' )
      def queryActionIcon( self, category, action_id
!                        , default=None, context=None ):
  
          """ Return an icon ID for the given action.
  
--- 185,191 ----
  
      security.declareProtected( View, 'queryActionIcon' )
      def queryActionIcon( self, category, action_id
!                        , default=None, context=None, resolve_icon=1 ):
  
          """ Return an icon ID for the given action.
  
***************
*** 195,201 ****
            TALES expressions.
          """
          ai = self._lookup.get( ( category, action_id ) )
!         return ai and ai.getIconURL( context ) or default
  
      security.declareProtected( View, 'updateActionDicts' )
      def updateActionDicts( self, categorized_actions, context=None ):
--- 195,201 ----
            TALES expressions.
          """
          ai = self._lookup.get( ( category, action_id ) )
!         return ai and (not resolve_icon or ai.getIconURL( context )) or default
  
      security.declareProtected( View, 'updateActionDicts' )
      def updateActionDicts( self, categorized_actions, context=None ):
***************
*** 305,311 ****
  
          o Raise KeyError if an icon has not already been defined.
          """
!         if self.queryActionIcon( category, action_id ) is None:
              raise KeyError, 'No such definition!'
  
          icons = list( self._icons )
--- 305,311 ----
  
          o Raise KeyError if an icon has not already been defined.
          """
!         if self.queryActionIcon( category, action_id, resolve_icon=0 ) is None:
              raise KeyError, 'No such definition!'
  
          icons = list( self._icons )


More information about the Zope-Dev mailing list