From: Maurits v. R. <svn...@pl...> - 2011-08-12 21:44:49
|
Author: maurits Date: Fri Aug 12 21:43:36 2011 New Revision: 243398 Modified: collective.depositbox/trunk/collective/depositbox/store.py Log: cleanup a bit Modified: collective.depositbox/trunk/collective/depositbox/store.py ============================================================================== --- collective.depositbox/trunk/collective/depositbox/store.py (original) +++ collective.depositbox/trunk/collective/depositbox/store.py Fri Aug 12 21:43:36 2011 @@ -2,8 +2,6 @@ import time import random from persistent import Persistent -from BTrees.IOBTree import IOBTree -from BTrees.OOBTree import OOBTree from persistent.mapping import PersistentMapping from zope.interface import implements @@ -21,11 +19,6 @@ self.confirmed = confirmed self.timestamp = int(time.time()) -# This may be prettier but may give (away) too much info. - # def __repr__(self): - # return '<BoxItem with token %r, value %r, confirmed %r, timestamp %r' % ( - # self.token, self.value, self.confirmed, self.timestamp) - class Box(Persistent): implements(IDepositBox) @@ -35,15 +28,12 @@ max_age = 7 def __init__(self): - #self.data = IOBTree() - #self.data = OOBTree() self.data = PersistentMapping() self._last_purge = int(time.time()) def _generate_new_id(self): """Generate new id. """ - #id = random.randint(1, MAX_ID) id = ''.join(random.sample('bcdfghjklmnpqrstvwxz23456789', 8)) while id in self.data.keys(): id = self._generate_new_id() @@ -104,7 +94,7 @@ if stored is None: return None if stored.token != token: - # raise Exception + # raise Exception? return None if not stored.confirmed: # First check if the confirmation comes too late. |