Exemplo n.º 1
0
 def show(self, id, format='html'):
     """GET /projects/id: Show a specific item"""
     if not serves_projects():
         response.status = '403 Forbidden (projects not enabled for this phyloplumber instance)'
         return 'Projects not enabled for this phyloplumber instance'
     c.project = read_project(id)
     return render('/show_project.html')
Exemplo n.º 2
0
 def new(self, format='html'):
     """GET /projects/new: Form to create a new item"""
     if not serves_projects():
         response.status = '403 Forbidden (projects not enabled for this phyloplumber instance)'
         return 'Projects not enabled for this phyloplumber instance'
     c.debug = is_debug_mode()
     return render('/new_project.html')
Exemplo n.º 3
0
 def index(self, format='html'):
     """GET /projects: All items in the collection"""
     if not serves_projects():
         response.status = '403 Forbidden (projects not enabled for this phyloplumber instance)'
         return 'Projects not enabled for this phyloplumber instance'
     sub = get_project_subdir_names()
     c.subdirs = [get_project_summary_tuple(i) for i in sub]
     return render('/projects.html')
Exemplo n.º 4
0
 def create(self):
     """POST /projects: Create a new item"""
     # Figure out what the next number to use for the subdirectory -- not guaranteed to be unique across instances, so this is not too crucial
     if not serves_projects():
         response.status = '403 Forbidden (projects not enabled for this phyloplumber instance)'
         return 'Projects not enabled for this phyloplumber instance'
     schema = NewProjectForm()
     try:
         c.form_result = schema.to_python(dict(request.params))
     except formencode.Invalid, error:
         c.form_result = error.value
         c.form_errors = error.error_dict or {}
         html = render('/new_project.html')
         return htmlfill.render(
             html,
             defaults=c.form_result,
             errors=c.form_errors
         )