Пример #1
0
 def save(self):
     self.load_data()
     transaction = self.database.get_transaction_class()
     commit = self.database.get_table_func(self._class.__name__,"commit_func")
     if not self.instance.handle:
         self.instance.handle = create_id()
     ## FIXME: should gid be assigned before this? YES, I think, and checked to make
     ## sure no dups
     with transaction("Gramps Connect", self.database) as trans:
         commit(self.instance, trans)
Пример #2
0
 def post(self, path):
     if "/" in path:
         handle, action = path.split("/")
     else:
         handle, action = path, "view"
     if handle == "add":
         family = Family()
         family.handle = handle = create_id()
     else:
         family = self.database.get_family_from_handle(handle)
     form = FamilyForm(self.database, self._, instance=family)
     form.save(handler=self)
     self.redirect("/family/%(handle)s" % {"handle": handle})
Пример #3
0
 def post(self, path):
     if "/" in path:
         handle, action = path.split("/")
     else:
         handle, action = path, "view"
     if handle == "add":
         citation = Citation()
         citation.handle = handle = create_id()
     else:
         citation = self.database.get_citation_from_handle(handle)
     form = CitationForm(self.database, self._, instance=citation)
     form.save(handler=self)
     self.redirect("/citation/%(handle)s" % {"handle": handle})
Пример #4
0
 def post(self, path):
     if "/" in path:
         handle, action = path.split("/")
     else:
         handle, action = path, "view"
     if handle == "add":
         note = Note()
         note.handle = handle = create_id()
     else:
         note = self.database.get_note_from_handle(handle)
     form = NoteForm(self.database, self._, instance=note)
     form.save(handler=self)
     self.redirect("/note/%(handle)s" % {"handle": handle})
Пример #5
0
 def post(self, path):
     if "/" in path:
         handle, action = path.split("/")
     else:
         handle, action = path, "view"
     if handle == "add":
         media = Media()
         media.handle = handle = create_id()
     else:
         media = self.database.get_media_from_handle(handle)
     form = MediaForm(self.database, self._, instance=media)
     form.save(handler=self)
     self.redirect("/media/%(handle)s" % {"handle": handle})
Пример #6
0
 def post(self, path):
     if "/" in path:
         handle, action = path.split("/")
     else:
         handle, action = path, "view"
     if handle == "add":
         place = Place()
         place.handle = handle = create_id()
     else:
         place = self.database.get_place_from_handle(handle)
     form = PlaceForm(self.database, self._, instance=place)
     form.save(handler=self)
     self.redirect("/place/%(handle)s" % {"handle": handle})
Пример #7
0
 def post(self, path):
     if "/" in path:
         handle, action = path.split("/")
     else:
         handle, action = path, "view"
     if handle == "add":
         event = Event()
         event.handle = handle = create_id()
     else:
         event = self.database.get_event_from_handle(handle)
     form = EventForm(self.database, self._, instance=event)
     form.save(handler=self)
     self.redirect("/event/%(handle)s" % {"handle": handle})
Пример #8
0
 def post(self, path):
     if "/" in path:
         handle, action = path.split("/")
     else:
         handle, action = path, "view"
     if handle == "add":
         repository = Repository()
         repository.handle = handle = create_id()
     else:
         repository = self.database.get_repository_from_handle(handle)
     form = RepositoryForm(self.database, self._, instance=repository)
     form.save(handler=self)
     self.redirect("/repository/%(handle)s" % {"handle": handle})
Пример #9
0
 def post(self, path):
     if "/" in path:
         handle, action = path.split("/")
     else:
         handle, action = path, "view"
     if handle == "add":
         tag = Tag()
         tag.handle = handle = create_id()
     else:
         tag = self.database.get_tag_from_handle(handle)
     form = TagForm(self.database, self._, instance=tag)
     form.save(handler=self)
     self.redirect("/tag/%(handle)s" % {"handle": handle})
Пример #10
0
 def post(self, path):
     if "/" in path:
         handle, action = path.split("/")
     else:
         handle, action = path, "view"
     if handle == "add":
         person = Person()
         person.primary_name.surname_list.append(Surname())
         person.handle = handle = create_id()
     else:
         person = self.database.get_person_from_handle(handle)
     form = PersonForm(self.database, self._, instance=person)
     form.save(handler=self)
     self.redirect("/person/%(handle)s" % {"handle": handle})