本文整理匯總了Python中weberp.lib.helpers.Error.id方法的典型用法代碼示例。如果您正苦於以下問題:Python Error.id方法的具體用法?Python Error.id怎麽用?Python Error.id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類weberp.lib.helpers.Error
的用法示例。
在下文中一共展示了Error.id方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
def create(self):
"""POST /users: Create a new item."""
if "email_usr" not in request.params or "password_usr" not in request.params:
error = Error()
error.id = 4
error.message = "Missing required data. At least username/password must be supplied"
c.error = error
return render("users/error.mako")
email = request.params['email_usr']
result = model.User.query().filter(User.email_usr == email).all()
if len(result) > 0:
error = Error()
error.id = 5
error.message = "Username already in use"
c.error = error
return render("users/error.mako")
password = request.params["password_usr"]
name = request.params["name_usr"]
status = 2 if "status_usr" not in request.params else request.params["status_usr"]
address = request.params["address_usr"] if "address_usr" in request.params else None
phone = request.params["phone_usr"] if "phone_usr" in request.params else None
teamid = request.params["teamid_usr"] if "teamid_usr" in request.params else None
managerid = request.params["managerid_usr"] if "managerid_usr" in request.params else None
salary = request.params["salary_usr"] if "salary_usr" in request.params else None
notes = request.params["notes_usr"] if "notes_usr" in request.params else None
user = model.User(email, password, name, status, address, phone, salary, teamid, managerid, notes)
model.meta.Session.add(user)
model.meta.Session.commit()
return render("users/opstatus.mako")
示例2: update
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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")
示例3: update
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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")
示例4: update
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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")
示例5: index
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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")
示例6: show
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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')
示例7: show
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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")
示例8: index
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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")
示例9: teams_for_manager
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
def teams_for_manager(self, id):
teams = model.Team.query().filter(Team.managerid_tms == id).all()
if len(teams) == 0:
error = Error()
error.id = 5
error.message = "No teams for manager id %s." % id
c.error = error
return render("users/error.mako")
c.teams = teams
return render("teams/index.mako")
示例10: show
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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")
示例11: show
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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")
示例12: index
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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")
示例13: tasks_for_user
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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")
示例14: show
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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')
示例15: sent
# 需要導入模塊: from weberp.lib.helpers import Error [as 別名]
# 或者: from weberp.lib.helpers.Error import id [as 別名]
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')