← Back to team overview

divmod-dev team mailing list archive

[Merge] lp:~lvh/divmod.org/remove-unsignedid-1269343 into lp:divmod.org

 

Laurens Van Houtven has proposed merging lp:~lvh/divmod.org/remove-unsignedid-1269343 into lp:divmod.org.

Requested reviews:
  Divmod-dev (divmod-dev)

For more details, see:
https://code.launchpad.net/~lvh/divmod.org/remove-unsignedid-1269343/+merge/202684

unsignedID was deprecated and recently removed in twisted trunk. This fixes that, by using id instead.
-- 
https://code.launchpad.net/~lvh/divmod.org/remove-unsignedid-1269343/+merge/202684
Your team Divmod-dev is requested to review the proposed merge of lp:~lvh/divmod.org/remove-unsignedid-1269343 into lp:divmod.org.
=== modified file 'Axiom/axiom/item.py'
--- Axiom/axiom/item.py	2013-05-02 12:49:35 +0000
+++ Axiom/axiom/item.py	2014-01-22 14:58:43 +0000
@@ -10,7 +10,6 @@
 
 from twisted.python import log
 from twisted.python.reflect import qual, namedAny
-from twisted.python.util import unsignedID
 from twisted.python.util import mergeFunctionMetadata
 from twisted.application.service import IService, IServiceCollection, MultiService
 
@@ -563,23 +562,16 @@
 
     store = property(*store())
 
+
     def __repr__(self):
         """
         Return a nice string representation of the Item which contains some
         information about each of its attributes.
         """
-
-        L = [self.__name__]
-        L.append('(')
-        A = []
-        for nam, atr in sorted(self.getSchema()):
-            V = atr.reprFor(self)
-            A.append('%s=%s' % (nam, V))
-        A.append('storeID=' + str(self.storeID))
-        L.append(', '.join(A))
-        L.append(')')
-        L.append('@0x%X' % unsignedID(self))
-        return ''.join(L)
+        attrs = ", ".join("{n}={v}".format(n=name, v=attr.reprFor(self))
+                          for name, attr in sorted(self.getSchema()))
+        template = b"{s.__name__}({attrs}, storeID={s.storeID})@{id:#x}"
+        return template.format(s=self, attrs=attrs, id=id(self))
 
 
     def __subinit__(self, **kw):
@@ -1145,4 +1137,3 @@
 
 POWERUP_BEFORE = 1              # Priority for 'high' priority powerups.
 POWERUP_AFTER = -1              # Priority for 'low' priority powerups.
-

=== modified file 'Axiom/axiom/store.py'
--- Axiom/axiom/store.py	2013-07-04 16:01:15 +0000
+++ Axiom/axiom/store.py	2014-01-22 14:58:43 +0000
@@ -4,7 +4,6 @@
 """
 This module holds the Axiom Store class and related classes, such as queries.
 """
-
 from epsilon import hotfix
 hotfix.require('twisted', 'filepath_copyTo')
 
@@ -17,7 +16,6 @@
 from twisted.python import filepath
 from twisted.internet import defer
 from twisted.python.reflect import namedAny
-from twisted.python.util import unsignedID
 from twisted.application.service import IService, IServiceCollection
 
 from epsilon.pending import PendingEvent
@@ -1344,12 +1342,12 @@
 
 
     def __repr__(self):
-        d = self.dbdir
-        if d is None:
-            d = '(in memory)'
-        else:
-            d = repr(d)
-        return '<Store %s@0x%x>' % (d, unsignedID(self))
+        dbdir = self.dbdir
+        if self.dbdir is None:
+            dbdir = '(in memory)'
+
+        return "<Store {dbdir}@{id:#x}".format(dbdir, id=id(self))
+
 
     def findOrCreate(self, userItemClass, __ifnew=None, **attrs):
         """


References