Skip to content

Commit

Permalink
Changed all the meta.Session.begin()'s to begin_nested()'s to solve O…
Browse files Browse the repository at this point in the history
…RM problems on production server
  • Loading branch information
kusinwolf committed Apr 21, 2010
1 parent 43f32d2 commit 9c51195
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions kusinwolf/PylonsApps/iman/iman/controllers/blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def comment_edit(self, id):
def comment_update(self, id):
'''functional method'''
if meta.Session.query(Comment).filter_by(id=id).count():
meta.Session.begin()
meta.Session.begin_nested()
comment = meta.Session.query(Comment).filter_by(id=id).one()
user_response = comment.response[0]
question = user_response.question[0]
Expand All @@ -87,7 +87,7 @@ def comment_update(self, id):

def comment_insert(self):
'''functional method'''
meta.Session.begin()
meta.Session.begin_nested()

user = meta.Session.query(User).filter_by(username=session['identity'].username).one()

Expand Down Expand Up @@ -125,7 +125,7 @@ def question_update(self, id):
Commits all changes of the question to the database
'''
if meta.Session.query(Question).filter_by(id=id).count():
meta.Session.begin()
meta.Session.begin_nested()
question = meta.Session.query(Question).filter_by(id = id).one()
user_id = session['identity'].uid

Expand All @@ -144,7 +144,7 @@ def question_update_changed(self, id):
Updates the question's modified record in the database
'''
if meta.Session.query(Question).filter_by(id=id).count():
meta.Session.begin()
meta.Session.begin_nested()
question = meta.Session.query(Question).filter_by(id = id).one()
user_id = session['identity'].uid

Expand Down Expand Up @@ -188,7 +188,7 @@ def question_show(self, id):

def question_insert(self):
'''functional method'''
meta.Session.begin()
meta.Session.begin_nested()

user = meta.Session.query(User).filter_by(username = session['identity'].username).one()

Expand Down Expand Up @@ -238,7 +238,7 @@ def response_edit(self, id):
def response_update(self, id):
'''functional method'''
if meta.Session.query(Response).filter_by(id = id).count():
meta.Session.begin()
meta.Session.begin_nested()
user_response = meta.Session.query(Response).filter_by(id = id).one()
question = user_response.question[0]
user_id = session['identity'].uid
Expand All @@ -255,7 +255,7 @@ def response_update(self, id):

def response_insert(self):
'''functional method'''
meta.Session.begin()
meta.Session.begin_nested()

user = meta.Session.query(User).filter_by(username = session['identity'].username).one()

Expand Down
2 changes: 1 addition & 1 deletion kusinwolf/PylonsApps/iman/iman/controllers/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def weight_delete(self):
def weight_add(self):
'''functional method'''

#meta.Session.begin()
meta.Session.begin_nested()
meta.Session.save(
Weight(weight = float(request.POST.get("weight")),
user_id = int(session['identity'].uid),
Expand Down
2 changes: 1 addition & 1 deletion kusinwolf/PylonsApps/iman/iman/controllers/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def index(self):

def event_create(self):
'''functional method'''
meta.Session.begin()
meta.Session.begin_nested()

event = Event(
start = datetime(year=int(request.POST.get("start_year")), month=int(request.POST.get("start_month")), day=int(request.POST.get("start_day")), hour=int(request.POST.get("start_hour")), minute=int(request.POST.get("start_minute")), second=int(request.POST.get("start_second"))),
Expand Down
2 changes: 1 addition & 1 deletion kusinwolf/PylonsApps/iman/iman/controllers/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def task_delete(self):
def task_create(self):
'''functional method'''

meta.Session.begin()
meta.Session.begin_nested()
meta.Session.save(
Task(task = str(request.POST.get("task")),
user_id = int(session['identity'].uid),
Expand Down

0 comments on commit 9c51195

Please sign in to comment.