Example #1
0
File: doc.py Project: Etenil/anvil
 def do_edit_doc(self, project, docname):
     p = self._admin_or_die(project)
     d = model.doc.Doc(name=docname)
     f = self._make_doc_form()
     if not f.validates():
         return common.render.docedit(doc=d, form=f, proj=project, htTitle="Edit document")
     i = web.input()
     d.name = normalize_name(i.title)
     d.title = i.title
     d.content = i.content
     event.add(
         username=common.session.user,
         projectname=project,
         type=event.EV_DOC,
         link=config.prefix + "/" + project + "/doc/" + doc.name,
         msg=("Document %s edited" % d.title),
     )
     d.save()
     raise web.seeother(config.prefix + "/" + project + "/doc/" + d.name)
Example #2
0
File: doc.py Project: Etenil/anvil
 def do_new_doc(self, project):
     p = self._admin_or_die(project)
     f = self._make_doc_form()
     if not f.validates():
         return common.render.docedit(form=f, proj=project, htTitle="New document for " + p.name)
     u = model.user.User(name=common.session.user)
     i = web.input()
     doc = model.doc.Doc()
     doc.project = p.id
     doc.name = normalize_name(i.title)
     doc.title = i.title
     doc.content = i.content
     doc.author = u.id
     event.add(
         user=u.id,
         project=p.id,
         type=event.EV_DOC,
         link=config.prefix + "/" + project + "/doc/" + doc.name,
         msg=("Document %s added" % doc.title),
     )
     doc.save()
     raise web.seeother(config.prefix + "/" + project + "/doc/" + doc.name)