Skip to content

Commit

Permalink
log errors of preprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
rochacbruno committed Jul 10, 2012
1 parent 2602876 commit 7311f78
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions modules/handlers/article.py
Expand Up @@ -654,22 +654,25 @@ def edit(self):
try:
exec(content_type.preprocess or "") in locals()
except Exception, e:
print str(e)
with open("preprocess_error.log", "a") as log:
log.write(str(e))
# END PREPROCESS EXEC
self.context.article_form = SQLFORM(self.db.article, self.context.article, _id="article_form")

def validate_form(form, self=self):
try:
exec(content_type.postprocess or "") in locals()
except Exception, e:
print str(e)
with open("postprocess_error.log", "a") as log:
log.write(str(e))

if self.context.article_form.process(onvalidation=validate_form).accepted:
# acceptedROCESS EXEC
try:
exec(content_type.acceptedprocess or "") in locals()
except Exception, e:
print str(e)
with open("acceptedprocess_error.log", "a") as log:
log.write(str(e))
# END acceptedROCESS EXEC
if self.context.article.is_active == False:
self.context.article.update_record(is_active=True)
Expand Down Expand Up @@ -723,14 +726,16 @@ def new(self):
try:
exec(content_type.preprocess or "") in locals()
except Exception, e:
print str(e)
with open("preprocess_error.log", "a") as log:
log.write(str(e))
# END PREPROCESS EXEC

def validate_form(form, self=self):
try:
exec(content_type.postprocess or "") in locals()
except Exception, e:
print str(e)
with open("postprocess_error.log", "a") as log:
log.write(str(e))

self.context.form = SQLFORM.factory(self.db.article, content.entity, table_name="article", formstyle='divs', separator='', _id="article_form")
self.context.customfield = customfield
Expand All @@ -739,7 +744,8 @@ def validate_form(form, self=self):
try:
exec(content_type.acceptedprocess or "") in locals()
except Exception, e:
print str(e)
with open("acceptedprocess_error.log", "a") as log:
log.write(str(e))
# END acceptedROCESS EXEC
try:
article_id = self.db.article.insert(**self.db.article._filter_fields(self.context.form.vars))
Expand Down

0 comments on commit 7311f78

Please sign in to comment.