本文整理匯總了Python中weberp.lib.helpers.Error類的典型用法代碼示例。如果您正苦於以下問題:Python Error類的具體用法?Python Error怎麽用?Python Error使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Error類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: update
def update(self, id):
contact = model.Contact.query().get(id)
if contact == None:
error = Error()
error.id = 1
error.message = "Contact with id %s does not exist." % id
c.error = error
return render("users/error.mako")
if "denumire_con" in request.params:
contact.denumire_con = request.params["denumire_con"]
if "persoana_con" in request.params:
contact.persoana_con = request.params["persoana_con"]
if "email_con" in request.params:
contact.email_con = request.params["email_con"]
if "phone_con" in request.params:
contact.phone_con = request.params["phone_con"]
if "adresa_con" in request.params:
contact.adresa_con = request.params["adresa_con"]
if "tip_con" in request.params:
contact.tip_con = request.params["tip_con"]
if "addedby_con" in request.params:
contact.addedby_con = request.params["addedby_con"]
if "visible_con" in request.params:
contact.visible_con = request.params["visible_con"]
model.meta.Session.commit()
return render("users/opstatus.mako")
示例2: update
def update(self, id):
document = model.Document.query().get(id)
if document is None:
error = Error()
error.id = 2
error.message = "The document with id %s does not exist" % id
c.error = error
return render("users/error.mako")
permanent_store = "%s/%s/" % (self.document_store, document.idprj_doc)
old_file_location = "%s/%s/%s" % (self.document_store, document.idprj_doc, document.file_doc)
if "name_doc" in request.params:
document.name_doc = request.params["name"]
if "idprj_doc" in request.params:
document.idprj_doc = request.params["project_id"]
if "file_doc" in request.params:
# overwrite old file
os.remove(old_file_location)
myfile = request.POST["file_doc"]
filename = myfile.filename.lstrip(os.sep)
permanent_file = open(os.path.join(permanent_store, filename), "w")
shutil.copyfileobj(myfile.file, permanent_file)
myfile.file.close()
permanent_file.close()
document.file_doc = filename
model.meta.Session.commit()
return render("users/opstatus.mako")
示例3: update
def update(self, id):
meeting = model.Meeting.query().get(id)
if meeting is None:
error = Error()
error.id = 1
error.message = "Meeting with id %s does not exist." % id
c.error = error
return render("users/error.mako")
if "subject_met" in request.params:
meeting.subject_met = request.params["subject_met"]
if "location_met" in request.params:
meeting.location_met = request.params["location_met"]
if "participants_met" in request.params:
meeting.participants_met = request.params["participants_met"]
if "owner_met" in request.params:
meeting.owner_met = request.params["owner_met"]
if "start_met" in request.params:
meeting.start_met = datetime.strptime(request.params["start_met"], "%Y/%m/%d")
if "end_met" in request.params:
meeting.end_met = datetime.strptime(request.params["end_met"], "%Y/%m/%d")
if "notes_met" in request.params:
meeting.notes_met = request.params["notes_met"]
model.meta.Session.commit()
return render("users/opstatus.mako")
示例4: index
def index(self):
c.users = model.User.query().all()
if c.users is None or len(c.users) == 0:
error = Error()
error.id = 1
error.message = "No users in the system"
c.error = error
return render("users/error.mako")
return render("users/index.mako")
示例5: show
def show(self, id):
task = model.Task.query().get(id)
if task is None:
error = Error()
error.id = 1
error.message = "Task with id %s does not exist." % id
c.error = error
return render("users/error.mako")
c.tasks = [task]
return render("tasks/index.mako")
示例6: index
def index(self):
tasks = model.Task.query().all()
if len(tasks) == 0:
error = Error()
error.id = 1
error.message = "No data in the system."
c.error = error
return render("users/error.mako")
c.tasks = tasks
return render("tasks/index.mako")
示例7: tasks_for_user
def tasks_for_user(self, id):
tasks = model.Task.query().filter(or_(Task.added_by_tsk == id, Task.assignedto_tsk == id)).all()
if len(tasks) == 0:
error = Error()
error.id = 1
error.message = "No data in the system."
c.error = error
return render("users/error.mako")
c.tasks = tasks
return render("tasks/index.mako")
示例8: show
def show(self, id):
message = model.Message.query().get(id)
if message is None:
error = Error()
error.id = 2
error.message = "Message with id %s does not exist." % id
c.error = error
return render("users/error.mako")
c.messages = [message]
return render('messages/index.mako')
示例9: sent
def sent(self, id):
messages = model.Message.query().filter(Message.from_msg == id).all()
if len(messages) == 0:
error = Error()
error.id = 1
error.message = "No data in the system."
c.error = error
return render("users/error.mako")
c.messages = messages
return render('messages/index.mako')
示例10: filter_by_team
def filter_by_team(self, id):
result = model.Project.query().filter(Project.owned_by_prj == id).all()
if len(result) == 0: #nothing in db
error = Error()
error.id = 1
error.message = "Team with id %s has no projects" % id
c.error = error
return render("users/error.mako")
c.projects = result
return render("projects/index.mako")
示例11: parteneri_for_user
def parteneri_for_user(self, id):
result = model.Contact.query().filter(or_(Contact.addedby_con == id, Contact.visible_con == 0)).filter(Contact.tip_con == 2).all()
if len(result) == 0:
error = Error()
error.id = 1
error.message = "No data in the system."
c.error = error
return render("users/error.mako")
c.contacts = result
return render('/contacts/index.mako')
示例12: show
def show(self, id):
meeting = model.Meeting.query().get(id)
if meeting is None:
error = Error()
error.id = 1
error.message = "Meeting with id %s does not exist." % id
c.error = error
return render("users/error.mako")
c.meetings = [meeting]
return render("meetings/index.mako")
示例13: show
def show(self, id):
result = model.Project.query().get(id)
if result is None: #nothing in db
error = Error()
error.id = 2
error.message = "The project with the id %s does not exist" % id
c.error = error
return render("users/error.mako")
c.projects = [result]
return render('projects/index.mako')
示例14: index
def index(self):
meetings = model.Meeting.query().all()
if len(meetings) == 0:
error = Error()
error.id = 1
error.message = "No data in the system."
c.error = error
return render("users/error.mako")
c.meetings = meetings
return render("meetings/index.mako")
示例15: show
def show(self, id):
result = model.Document.query().get(id)
if result is None:
error = Error()
error.id = 2
error.message = "The document with id %s does not exist" % id
c.error = error
return render("users/error.mako")
c.documents = [result]
return render("documents/index.mako")