當前位置: 首頁>>代碼示例>>Python>>正文


Python helpers.Error類代碼示例

本文整理匯總了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")
開發者ID:bbox,項目名稱:bluebox,代碼行數:35,代碼來源:contacts.py

示例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")
開發者ID:bbox,項目名稱:bluebox,代碼行數:31,代碼來源:documents.py

示例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")
開發者ID:bbox,項目名稱:bluebox,代碼行數:32,代碼來源:meetings.py

示例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")
開發者ID:bbox,項目名稱:bluebox,代碼行數:9,代碼來源:users.py

示例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")
開發者ID:bbox,項目名稱:bluebox,代碼行數:10,代碼來源:tasks.py

示例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")
開發者ID:bbox,項目名稱:bluebox,代碼行數:10,代碼來源:tasks.py

示例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")		
開發者ID:bbox,項目名稱:bluebox,代碼行數:10,代碼來源:tasks.py

示例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')
開發者ID:bbox,項目名稱:bluebox,代碼行數:10,代碼來源:messages.py

示例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')				
開發者ID:bbox,項目名稱:bluebox,代碼行數:10,代碼來源:messages.py

示例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")
開發者ID:bbox,項目名稱:bluebox,代碼行數:10,代碼來源:projects.py

示例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')								
開發者ID:bbox,項目名稱:bluebox,代碼行數:10,代碼來源:contacts.py

示例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")
開發者ID:bbox,項目名稱:bluebox,代碼行數:10,代碼來源:meetings.py

示例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')
開發者ID:bbox,項目名稱:bluebox,代碼行數:10,代碼來源:projects.py

示例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")
開發者ID:bbox,項目名稱:bluebox,代碼行數:10,代碼來源:meetings.py

示例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")
開發者ID:bbox,項目名稱:bluebox,代碼行數:10,代碼來源:documents.py


注:本文中的weberp.lib.helpers.Error類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。