Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 37 def decfunc(f):
- 38 def inner(self, *args):
- 39 global classObject
- 40 if self == classObject:
- 41 if self.store == None:#for the case when same object is used for calling more than one functions
- 42 self.store = Store(self.database)
- 43 result = f(self,*args)
- 44 self.store.commit()
- 45 self.store.close()
- 46 self.store = None
- 47 else:#To handle the nesting issue
- 48 result = f(self,*args)
- 49 self.store.commit()
- 50 else:#for the case whenever a new object calls its decorated member function
- 51 classObject = self
- 52 self.store = Store(self.database)
- 53 result = f(self,*args)
- 54 self.store.commit()
- 55 self.store.close()
- 56 self.store = None
- 57 return result
- 58 return inner
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement