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")
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")
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")
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")
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")
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")
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")
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')
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')
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")
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')
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")
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')
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")
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")
def index(self): result = model.Project.query().all() if len(result) == 0: #nothing in db error = Error() error.id = 1 error.message = "No data in the system" c.error = error return render("users/error.mako") c.projects = result return render('projects/index.mako')
def show(self, id): result = model.Contact.query().get(id) if result == None: error = Error() error.id = 1 error.message = "Contact with id %s does not exist." % id c.error = error return render("users/error.mako") c.contacts = [result] return render('/contacts/index.mako')
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")
def show(self, id): result = model.User.query().get(id) if result is None: error = Error() error.id = 2 error.message = "The user with the id %s does not exist" % id c.error = error return render("users/error.mako") c.user = result return render("users/login.mako")
def login(self, username, password): result = model.User.query().filter(User.email_usr == username).filter(User.password_usr == password).all() if result is None or len(result) == 0: error = Error() error.id = 3 error.message = "Bad username or password" c.error = error return render("users/error.mako") c.user = result[0] return render("users/login.mako")
def parteneri(self): result = model.Contact.query().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')
def index(self): result = model.Document.query().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.documents = result return render("documents/index.mako")
def delete(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") model.meta.Session.delete(contact) model.meta.Session.commit() return render("users/opstatus.mako")
def delete(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") model.meta.Session.delete(task) model.meta.Session.commit() return render("users/opstatus.mako")
def delete(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") model.meta.Session.delete(document) model.meta.Session.commit() return render("users/opstatus.mako")
def delete(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") model.meta.Session.delete(meeting) model.meta.Session.commit() return render("users/opstatus.mako")
def index(self): """GET /teams: All items in the collection.""" # url('teams') result = model.Team.query().all() if len(result) == 0: #nothing in db error = Error() error.id = 1 error.message = "No data in the system" c.error = error return render("users/error.mako") c.teams = result return render("teams/index.mako")
def delete(self, id): user = model.User.query().get(id) if user is None: error = Error() error.id = 2 error.message = "The user with the id %s does not exist" % id c.error = error return render("users/error.mako") model.meta.Session.delete(user) model.meta.Session.commit() return render("users/opstatus.mako")
def show(self, id): """GET /teams/id: Show a specific item.""" # url('teams', id=ID) result = model.Team.query().get(id) if result is None: error = Error() error.id = 2 error.message = "The team with the id %s does not exist" % id c.error = error return render("users/error.mako") c.teams = [result] return render("teams/index.mako")
def delete(self, id): team = model.Team.query().get(id) if team is None: error = Error() error.id = 2 error.message = "The team with the id %s does not exist" % id c.error = error return render("users/error.mako") model.meta.Session.delete(team) model.meta.Session.commit() return render("users/opstatus.mako")