def kind_add(kindname, values=None, flash=None): if values is None: values = {} kind = get_kind(kindname) flash = flash or get_flash() edit = False return template('admin_kind_add', **locals())
def kind_delete_do(kindname, key): kind = get_kind(kindname) flash = get_flash() instance = kind.get_by_key_name_or_abort(key) instance.delete() set_flash(SUCCESS, '%s was deleted' % key) redirect('/admin/%s/' % kindname)
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())
def kind_index(kindname): kind = get_kind(kindname) flash = get_flash() return template('admin_kind_index', **locals())
def index(): kinds = get_kinds() flash = get_flash() return template('admin_index', **locals())
def kind_delete(kindname, key): kind = get_kind(kindname) flash = get_flash() return template('admin_kind_delete', **locals())
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())
def run(flash=None): weavrs_instances = models.WeavrsInstance.all(keys_only=True) flash = flash or get_flash() return template('frontend_run_index', **locals())