I have scenario like this
def _vote(self, id, vote_number):
db_session = meta.Session()
#Up or Down
def voteup(self, id):
db_session = meta.Session()
#....Do some query with alchemy
self._vote(int(id), 1)
def votedown(self, id):
db_session = meta.Session()
#....Do some query with alchemy
self._vote(int(id), -1)
db_session = meta.Session()
Then I am trying to use meta.Session() in predicate
class minimum_reputation(Predicate):
message = "Your minimum score reputation must be of at least " \
"%(minimum_score)s, but you have %(current_score)s"
def __init__(self, minimum_score, **kwargs):
super(minimum_reputation, self).__init__(**kwargs)
self.minimum_score = minimum_score
def evaluate(self, environ, credentials):
user_name == credentials.get('repoze.what.userid')
db_session = meta.Session()
#do some stuff
If I create db_session = meta.Session(), should I clean or close the
db_session object? Or is it OK to leave it?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---