Changeset 4184
- Timestamp:
- 27 May 2009, 09:32:41 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/datacenter.py
r4183 r4184 144 144 memory only and will vanish as soon as the request is over. In 145 145 this case we can use the memory address of it. 146 147 Both, the id() result and the ZODB oid, are actually integers 148 which we return as strings. To make the difference chrystal 149 clear, we prepend ``z`` to ids taken from ZODB oids. 146 150 """ 147 151 if not hasattr(obj, '_p_oid'): 148 152 return str(id(obj)) 149 153 oid = getattr(obj, '_p_oid') 150 return str(struct.unpack('>Q', oid)[0]) 154 if oid is None: 155 # The persistent object is not stored in the ZODB 156 return str(id(obj)) 157 return 'z%s' % struct.unpack('>Q', oid)[0] 151 158 152 159
Note: See TracChangeset for help on using the changeset viewer.