Jean-François Roche avatar Jean-François Roche committed f7bc89e Merge

merge

Comments (0)

Files changed (10)

 fc5925e19e9b95a876878e5c7992c537739fe272 0.1
 ddffa59c6bd694da4f15cbf1ec24dc6db6cd02e1 0.2
 6eae84ef27cf83b3524b23a1cf5bdb3587e9fda9 0.3
+1a02802c782932b9d1469f2f2670f80303e8d843 0.4
+aa547e86f719071dfeb709c999f40e63ebb8a0b3 0.5
+e29de145701347274c30cc79cca0a886c99546c4 0.6
 Changelog
 =========
 
-0.4 (unreleased)
+0.7 (unreleased)
 ----------------
 
-- Nothing changed yet.
+- Fix subscriber when config code is not present in zope config file
+
+
+0.6 (2011-06-14)
+----------------
+
+- Remove logging definition from code, should be in config file
+
+
+0.5 (2011-06-09)
+----------------
+
+- Also compatible with Zope 2.10/2.11
+
+
+0.4 (2011-06-09)
+----------------
+
+- Change transactionmanager order to be the very last one
 
 
 0.3 (2011-02-22)
 from setuptools import setup, find_packages
 import os
 
-version = '0.4dev'
+version = '0.7dev'
 
 setup(name='affinitic.zamqp',
       version=version,
                   'publishmsg = affinitic.zamqp.publisher:main']},
       extras_require=dict(
             test=['zope.testing', 'Zope2', 'five.dbevent'],
-            zope210=['five.dbevent', 'uuid'],
+            zope210=['five.dbevent', 'uuid', 'python-cjson'],
             zope212=['five.dbevent', 'Zope2'],
             zope213=['Zope2'],
             docs=['z3c.recipe.sphinxdoc',

src/affinitic/zamqp/__init__.py

 import logging
-from logging.handlers import TimedRotatingFileHandler
 LOGGER = 'affinitic.zamqp'
 logger = logging.getLogger(LOGGER)
-logger.setLevel(logging.DEBUG)
-fh = TimedRotatingFileHandler("amqp.log", 'midnight', 1)
-fh.suffix = "%Y-%m-%d-%H-%M"
-formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
-fh.setFormatter(formatter)
-fh.setLevel(logging.DEBUG)
-logger.addHandler(fh)

src/affinitic/zamqp/configure.zcml

       <include package="five.dbevent" />
     </configure>
 
-    <subscriber
-        for="zope.processlifetime.IDatabaseOpenedWithRoot"
-        handler=".service.bootStrapSubscriber"/>
+    <configure zcml:condition="installed zope.processlifetime">
+      <subscriber
+          for="zope.processlifetime.IDatabaseOpenedWithRoot"
+          handler=".service.bootStrapSubscriber"/>
+      </configure>
+
+    <configure zcml:condition="installed zope.app.appsetup">
+      <subscriber
+          for="zope.app.appsetup.interfaces.IDatabaseOpenedWithRootEvent"
+          handler=".service.bootStrapSubscriber"/>
+    </configure>
 
     <grok:grok package="."/>
 

src/affinitic/zamqp/error.py

 class ErrorManager(object):
 
     def __init__(self, connectionId):
-        self.connectionId
+        self.connectionId = connectionId
 
     @property
     def errors(self):
                 consumerSet.add_consumer(consumerUtility)
         return consumerSet
 
-grok.global_utility(ConsumerSetFactory,
+grok.global_utility(ErrorConsumerSetFactory,
     provides=IFactory, name='ErrorConsumerSet')

src/affinitic/zamqp/message.py

             #return super(MessageWrapper, self).__getattr__(name)
         else:
             return getattr(self.context, name)
+
+    def sortKey(self, *ignored):
+        "Always be the last one !"
+        return '~zamqp 9'

src/affinitic/zamqp/processor.py

 from time import sleep
 from ZODB.POSException import ConflictError
 from zope.component import createObject, queryUtility
-from zope.component.hooks import setSite
+try:
+    from zope.component.hooks import setSite
+except ImportError:
+    from zope.app.component.hooks import setSite
 
 from affinitic.zamqp import logger
 from affinitic.zamqp.interfaces import IArrivedMessage, IErrorHandler

src/affinitic/zamqp/service.py

 
 def getAutostartServiceNames():
     """get a list of services to start"""
-    config = getConfiguration().product_config
+    config = getattr(getConfiguration(), 'product_config', None)
     if config is not None:
         task_config = config.get('affinitic.zamqp', None)
         if task_config:

src/affinitic/zamqp/transactionmanager.py

     tpc_abort = abort
 
     def sortKey(self, *ignored):
-        """ The sortKey method is used for recent ZODB compatibility which
-            needs to have a known commit order for lock acquisition.  Most
-            DA's talking to RDBMS systems do not care about commit order, so
-            return the constant 1
-        """
-        return 10
+        return '~zamqp'
 
 
 class Surrogate:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.