[Checkins] SVN: grok/branches/jw-philipp-using-ndir-directives/src/grok/directive.py LocalUtilityInfo objects have an inherit order.

Jan-Wijbrand Kolman janwijbrand at gmail.com
Sun May 4 06:27:16 EDT 2008


Log message for revision 86328:
  LocalUtilityInfo objects have an inherit order.

Changed:
  U   grok/branches/jw-philipp-using-ndir-directives/src/grok/directive.py

-=-
Modified: grok/branches/jw-philipp-using-ndir-directives/src/grok/directive.py
===================================================================
--- grok/branches/jw-philipp-using-ndir-directives/src/grok/directive.py	2008-05-04 10:26:40 UTC (rev 86327)
+++ grok/branches/jw-philipp-using-ndir-directives/src/grok/directive.py	2008-05-04 10:27:15 UTC (rev 86328)
@@ -84,6 +84,9 @@
 
 
 class LocalUtilityInfo(object):
+
+    _order = 0
+
     def __init__(self, factory, provides, name=u'',
                  setup=None, public=False, name_in_container=None):
         self.factory = factory
@@ -93,6 +96,15 @@
         self.public = public
         self.name_in_container = name_in_container
 
+        self.order = LocalUtilityInfo._order
+        LocalUtilityInfo._order += 1
+
+    def __cmp__(self, other):
+        # LocalUtilityInfos have an inherit sort order by which the
+        # registrations take place.
+        return cmp(self.order, other.order)
+
+
 class RequireDirectiveStore(StoreMultipleTimes):
 
     def get(self, directive, component, default):



More information about the Checkins mailing list