Esempio n. 1
0
 def setUp(self):
     super(ObjectManagerTests, self).setUp()
     self.saved_cfg_debug_mode = getConfiguration().debug_mode
     zcml.load_config('meta.zcml', Products.Five)
     zcml.load_config('event.zcml', Products.Five)
     zcml.load_config('deprecated.zcml', Products.Five)
     setDeprecatedManageAddDelete(ItemForDeletion)
Esempio n. 2
0
    def setUp(cls):
        # Mark HookCounter as five:deprecatedManageAddDelete
        from Products.Five.eventconfigure import setDeprecatedManageAddDelete
        from Products.ExtFile.tests import testCopySupportHooks

        setDeprecatedManageAddDelete(testCopySupportHooks.TestItem)
        setDeprecatedManageAddDelete(testCopySupportHooks.TestFolder)
Esempio n. 3
0
 def setUp(self):
     super(ObjectManagerTests, self).setUp()
     self.saved_cfg_debug_mode = getConfiguration().debug_mode
     zcml.load_config('meta.zcml', Products.Five)
     zcml.load_config('event.zcml', Products.Five)
     zcml.load_config('deprecated.zcml', Products.Five)
     setDeprecatedManageAddDelete(ItemForDeletion)
Esempio n. 4
0
 def setUp(cls):
     # Mark base class as five:deprecatedManageAddDelete
     try:
         from Products.Five.eventconfigure import setDeprecatedManageAddDelete
     except ImportError:
         pass
     else:
         from Products.ExtFile.tests import testCopySupport
         setDeprecatedManageAddDelete(testCopySupport.HookCounter)
Esempio n. 5
0
def initialize(context): 
    """Initialize the ExtFile product."""
    
    import ExtFile
    import ExtImage 

    try: 
        """Try to register the product."""
        
        context.registerClass(
            ExtFile.ExtFile,                        # Which is the addable bit? 
            constructors = (                        # The first of these is called 
                ExtFile.manage_addExtFileForm,      # when someone adds the product; 
                ExtFile.manage_addExtFile),         # the second is named here so we 
                                                    # can give people permission to call it. 
            icon = 'www/extFile.gif'                # This icon was provided by the 
            )                                       # Zope 1 product-in-Python demo. 
            
        context.registerClass(
            ExtImage.ExtImage,                      # Which is the addable bit? 
            constructors = (                        # The first of these is called 
                ExtImage.manage_addExtImageForm,    # when someone adds the product; 
                ExtImage.manage_addExtImage),       # the second is named here so we 
                                                    # can give people permission to call it. 
            icon = 'www/extImage.gif'               # This icon was provided by the 
            )                                       # Zope 1 product-in-Python demo. 
            
        # Mark as five:deprecatedManageAddDelete for Zope >= 2.9
        try:
            from Products.Five.eventconfigure import setDeprecatedManageAddDelete
        except ImportError:
            pass
        else:
            setDeprecatedManageAddDelete(ExtFile.ExtFile)
            setDeprecatedManageAddDelete(ExtImage.ExtImage)
    
    except:
        """If you can't register the product, tell someone."""
        
        import sys, traceback, string
        type, val, tb = sys.exc_info()
        sys.stderr.write(string.join(traceback.format_exception(type, val, tb), ''))
        del type, val, tb
Esempio n. 6
0
    def manage_afterAdd(self, item, container):
        eventlog.trace(self, 'manage_afterAdd')
        Folder.manage_afterAdd(self, item, container)

    def manage_afterClone(self, item):
        eventlog.trace(self, 'manage_afterClone')
        Folder.manage_afterClone(self, item)

    def manage_beforeDelete(self, item, container):
        eventlog.trace(self, 'manage_beforeDelete')
        Folder.manage_beforeDelete(self, item, container)


from Products.Five.eventconfigure import setDeprecatedManageAddDelete
setDeprecatedManageAddDelete(TestItem)
setDeprecatedManageAddDelete(TestFolder)


class HookTest(unittest.TestCase):
    def setUp(self):
        self.app = makerequest(Zope2.app())
        try:
            uf = self.app.acl_users
            uf._doAddUser('manager', 'secret', ['Manager'], [])
            user = uf.getUserById('manager').__of__(uf)
            newSecurityManager(None, user)
        except:
            self.tearDown()
            raise
Esempio n. 7
0
        self.id = id
    def _verifyObjectPaste(self, object, validate_src=1):
        pass # Always allow
    def manage_afterAdd(self, item, container):
        eventlog.trace(self, 'manage_afterAdd')
        Folder.manage_afterAdd(self, item, container)
    def manage_afterClone(self, item):
        eventlog.trace(self, 'manage_afterClone')
        Folder.manage_afterClone(self, item)
    def manage_beforeDelete(self, item, container):
        eventlog.trace(self, 'manage_beforeDelete')
        Folder.manage_beforeDelete(self, item, container)


from Products.Five.eventconfigure import setDeprecatedManageAddDelete
setDeprecatedManageAddDelete(TestItem)
setDeprecatedManageAddDelete(TestFolder)


class HookTest(unittest.TestCase):

    def setUp(self):
        self.app = makerequest(Zope2.app())
        try:
            uf = self.app.acl_users
            uf._doAddUser('manager', 'secret', ['Manager'], [])
            user = uf.getUserById('manager').__of__(uf)
            newSecurityManager(None, user)
        except:
            self.tearDown()
            raise
Esempio n. 8
0
 def setUp(cls):
     # Mark HookCounter as five:deprecatedManageAddDelete
     from Products.Five.eventconfigure import setDeprecatedManageAddDelete
     from Products.ExtFile.tests import testCopySupportHooks
     setDeprecatedManageAddDelete(testCopySupportHooks.TestItem)
     setDeprecatedManageAddDelete(testCopySupportHooks.TestFolder)