Exemplo n.º 1
0

# Utility route to inspect an object
@mongomanager.route('/collection/<className>/<id>')
@requires_perm('admin')
def object(className, id):
    try:
        classObj = getattr(db, className)
        anObject = classObj.objects(id=id).first()
        return render_template('object.html', anObject=anObject)
    except:
        return abort(404)


# Utility route to inspect and edit a single collection
mongomanager.app_template_global(getattr)


@mongomanager.route('/collection/<className>', methods=['GET', 'POST'])
@requires_perm('admin')
def collection(className):
    classObj = getattr(db, className)
    form = forms.ItemForm()
    if 'name' in classObj._fields.keys():
        itemList = classObj.objects().order_by('-iscurrent', '+name')
        form.remitem.choices = [(str(item.id), item.name) for item in itemList
                                if item.iscurrent]
    else:
        itemList = classObj.objects().order_by('-iscurrent', '+addeddate')
        form.remitem.choices = [(str(item.id), str(item.id))
                                for item in itemList if item.iscurrent]
Exemplo n.º 2
0
"""Blueprint for the uploader.

The uploader handles creation and deletion of files and projects, as well as
sending them to the processing pipeline.
"""

import os

from flask import Blueprint

uploader = Blueprint('uploader', __name__,
    template_folder='templates',
    static_folder="static",
    static_url_path=os.path.dirname(__file__))

from . import views
from . import models

uploader.app_template_global(views.generate_form_token)
Exemplo n.º 3
0
"""Blueprint for the uploader.

The uploader handles creation and deletion of files and projects, as well as
sending them to the processing pipeline.
"""

import os

from flask import Blueprint

static_url = os.path.dirname(
    __file__)  #Problem with this static absolute path. changed to relative
uploader = Blueprint('uploader',
                     __name__,
                     template_folder='templates',
                     static_folder="static",
                     static_url_path="/app/uploader")
#print os.path.dirname(__name__)

from .views import *

from . import errors

uploader.app_template_global(views.generate_form_token)