コード例 #1
0
def kind_edit(kindname, name, values=None, flash=None):
    if values is None:
        values = {}
    name = stripslashes(name)
    kind = get_kind(kindname)
    obj = kind.get_by_key_name_or_abort(name)
    key_name = obj.key().name()
    assert key_name is not None
    num_parts = len(kind.Meta.key_parts)
    key_parts = key_name.split(u"/")
    i = 0
    for k in kind.Meta.key_parts:
        v = key_parts[i]
        values[k] = v
        i += 1
    for p in kind.properties():
        if not p in values:
            values[p] = str(getattr(obj, p))
    del obj
    flash = flash or get_flash()
    edit = True
    return template('admin_kind_add', **locals())
コード例 #2
0
def kind_edit(kindname, name, values=None, flash=None):
    if values is None:
        values = {}
    name = stripslashes(name)
    kind = get_kind(kindname)
    obj = kind.get_by_key_name_or_abort(name)
    key_name = obj.key().name()
    assert key_name is not None
    num_parts = len(kind.Meta.key_parts)
    key_parts = key_name.split(u"/")
    i = 0
    for k in kind.Meta.key_parts:
        v = key_parts[i]
        values[k] = v
        i += 1
    for p in kind.properties():
        if not p in values:
            values[p] = str(getattr(obj, p))
    del obj
    flash = flash or get_flash()
    edit = True
    return template('admin_kind_add', **locals())
コード例 #3
0
def run_weavr(name, flash=None):
    name = stripslashes(name)
    weavr = models.Weavr.get_by_key_name_or_abort(name)
    queue_run_weavr(name)
    set_flash(SUCCESS, u"Run queued for weavr %s" % name)
    redirect('/')
コード例 #4
0
def run_instance(name, flash=None):
    name = stripslashes(name)
    weavrs_instance = models.WeavrsInstance.get_by_key_name_or_abort(name)
    weavrs = weavrs_instance.get_weavrs()
    flash = flash or get_flash()
    return template('frontend_run_instance', **locals())
コード例 #5
0
def run_weavr(name, flash=None):
    name = stripslashes(name)
    weavr = models.Weavr.get_by_key_name_or_abort(name)
    queue_run_weavr(name)
    set_flash(SUCCESS, u"Run queued for weavr %s" % name)
    redirect('/')
コード例 #6
0
def run_instance(name, flash=None):
    name = stripslashes(name)
    weavrs_instance = models.WeavrsInstance.get_by_key_name_or_abort(name)
    weavrs = weavrs_instance.get_weavrs()
    flash = flash or get_flash()
    return template('frontend_run_instance', **locals())