Example #1
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')
Example #2
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')
Example #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')
Example #4
0
 def delete(self, id):
     """DELETE /projects/id: Delete an existing item"""
     if not serves_projects():
         response.status = '403 Forbidden (projects not enabled for this phyloplumber instance)'
         return 'Projects not enabled for this phyloplumber instance'
     #  Forms posted to this method should contain a hidden field:
     #    <input type="hidden" name="_method" value="DELETE" />
     # Or using helpers:
     #    h.form(url('project', id=ID),
     #           method='delete')
     # url('project', id=ID)
     return u'blah delete'
Example #5
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
         )
Example #6
0
 def edit(self, id, format='html'):
     """GET /projects/id/edit: Form to edit an existing item"""
     if not serves_projects():
         response.status = '403 Forbidden (projects not enabled for this phyloplumber instance)'
         return 'Projects not enabled for this phyloplumber instance'
Example #7
0
 def update(self, id):
     """PUT /projects/id: Update an existing item"""
     if not serves_projects():
         response.status = '403 Forbidden (projects not enabled for this phyloplumber instance)'
         return 'Projects not enabled for this phyloplumber instance'
Example #8
0
 def index(self):
     if serves_projects():
         redirect(url(controller='projects', action='index'))
     else:
         redirect(url(controller='services', action='index'))