def object_edit(model_slug, model_key=None, **attrs): if model_slug not in models: abort(404) model = models[model_slug] sk = attrdict() if model_key: try: data = model.q.get_by(id=model_key) except NoData: abort(404) else: data = model sk.session = db if model_key: obj = model.q.get_by(id=int(model_key)) else: obj = None fields = FieldSet(data, **sk) _fixup_fs(fields,model_key,attrs) if request.method == 'POST': fields.rebind(data=request.form) if fields.validate(): fields.sync() next_url = url_for('_admin.object_list', model_slug=model_slug) return redirect(next_url) context = { 'model_slug': model_slug, 'model': model, 'fields': fields, } template_name = '_admin/edit.html' if model_key else '_admin/new.html' return render_template(template_name, **context)
def object_edit(model_slug, model_key=None, **attrs): if model_slug not in models: abort(404) model = models[model_slug] sk = attrdict() if model_key: try: data = model.q.get_by(id=model_key) except NoData: abort(404) else: data = model sk.session = db if model_key: obj = model.q.get_by(id=int(model_key)) else: obj = None fields = FieldSet(data, **sk) _fixup_fs(fields, model_key, attrs) if request.method == 'POST': fields.rebind(data=request.form) if fields.validate(): fields.sync() next_url = url_for('_admin.object_list', model_slug=model_slug) return redirect(next_url) context = { 'model_slug': model_slug, 'model': model, 'fields': fields, } template_name = '_admin/edit.html' if model_key else '_admin/new.html' return render_template(template_name, **context)
def config_rss(): user = request.user if user.anon: flash("Du musst dich erst einloggen.") return redirect( url_for("pybble.login.do_login", next=url_for("pybble.rss.config_rss"))) form = RSSForm(request.form, prefix="rss") if request.method == 'POST' and form.validate(): user.feed_age = int(form.age.data) if form.new_id.data or not user.feed_pass: user.feed_pass = unicode(random_string(30)) flash(u"Gespeichert.", True) return redirect(url_for("pybble.views.mainpage")) elif request.method == 'GET': form.age.data = str(user.feed_age) new_feed = not user.has_trackers return render_template('rssconfig.html', form=form, title_trace=["RSS-Einstellungen"], new_feed=new_feed)
def editor(request, obj=None, parent=None): form = GroupForm(request.form, prefix="perm") if request.method == 'POST' and form.validate(): name = form.name.data if parent is None: obj = Group.new(name=name, parent=parent) else: data = obj.data obj.name = name flash(u"Gespeichert.", True) return redirect(url_for("pybble.views.view_oid", oid=obj.oid)) elif request.method == 'GET': if obj: form.name.data = obj.name else: form.name.data = "" return render_template( 'edit/group.html', parent=parent, obj=obj, form=form, title_trace=["New Group" if parent else "Edit Group"])
def editor(request, obj=None, parent=None): form = MemberForm(request.form, prefix="perm") if request.method == 'POST' and form.validate(): user = Object.by_oid(form.user.data) group = Object.by_oid(form.group.data) excluded = bool(form.excluded.data) if parent: obj = Member.new(user, group) else: data = obj.data obj.owner = user obj.parent = group obj.excluded = excluded obj.record_change(data) flash(u"Gespeichert.",True) return redirect(url_for("pybble.views.view_oid", oid=user.oid)) elif request.method == 'GET': if obj: form.group.data = parent.oid if parent else obj.parent.oid form.user.data = obj.owner.oid form.excluded.data = obj.excluded else: form.user.data = request.user.oid form.group.data = parent.oid form.excluded.data = False return render_template('edit/member.html', parent=parent, obj=obj, form=form, title_trace=["New Member" if parent else "Edit Member"])
def edit_wanttracking(oid=None): """Sub-list below the current object""" obj = Object.by_oid(oid) if isinstance(obj,WantTracking): return editor(obj) else: # show list of tracks for that object return render_template('wanttrackinglist.html', obj=obj, title_trace=["Beobachtungsliste"])
def list_templates(oid=None): """List all named templates""" obj = Object.by_oid(oid) if oid else current_site s = obj t = [] while s: t.extend(Template.q.filter_by(target=s).order_by(Template.name)) s = s.parent return render_template('templates.html', templates=t, obj=obj, title_trace=["Templates",current_site.name])
def newer(parent, name=None): from pybble.core.models.site import App form = SiteEditForm(request.form, prefix="site", app=current_site.app.oid, parent=parent.oid if parent else current_site.oid) form.app.choices = tuple((o.oid,str(o)) for o in App.q.all()) form.parent.choices = tuple((o.oid,str(o)) for o in Site.q.all()) if request.method == 'POST' and form.validate(): obj = Site.new(form.domain.data, form.name.data, parent=Object.by_oid(form.parent.data), app=Object.by_oid(form.app.data)) return redirect(url_for("pybble.views.view_oid", oid=obj.oid)) return render_template('edit/site.html', obj=None, form=form, title_trace=["neue Website"])
def view_all(): user = request.user f = (UserTracker.user == user) last = session.get("chg_",None) if last and time()-last[0] < 2*60: pass else: session["chg_"] = (int(time()), user.feed_read) user.feed_read = datetime.utcnow() return render_template("changelist.html", changes=UserTracker.q.filter(f).order_by(UserTracker.id.desc())[0:30])
def list_templates(oid=None): """List all named templates""" obj = Object.by_oid(oid) if oid else current_site s = obj t = [] while s: t.extend(Template.q.filter_by(target=s).order_by(Template.name)) s = s.parent return render_template('templates.html', templates=t, obj=obj, title_trace=["Templates", current_site.name])
def editor(obj=None, parent=None): form = PermissionForm(request.form, prefix="perm") form.for_objtyp.choices = tuple((str(x.id),x.name) for x in ObjType.q.all()) form.new_objtyp.choices = (('-','–'),) + form.for_objtyp.choices form.new_mimetyp.choices = (('-','–'),) + tuple((str(x.id),x.name) for x in MIMEtype.q.all()) if request.method == 'POST' and form.validate(): user = Object.by_oid(form.user.data) dest = Object.by_oid(form.target.data) for_objtyp = int(form.for_objtyp.data) new_objtyp = ObjType.get(int(form.new_objtyp.data)) if form.new_objtyp.data != "-" else None new_mimetyp = MIMEtype.id.get_by(form.new_mimetyp.data) if form.new_mimetyp.data != "-" else None right = int(form.right.data) if form.inherit.data == "Yes": inherit = True elif form.inherit.data == "No": inherit = False elif form.inherit.data == "*": inherit = None else: assert False if parent: obj = Permission.new(user, dest, for_objtyp,new_objtyp=new_objtyp,new_mimetyp=new_mimetyp, right=right, inherit=inherit) else: obj.owner = user obj.parent = dest obj.for_objtyp = for_objtyp obj.right = right obj.inherit = inherit obj.new_objtyp = new_objtyp obj.new_mimetyp = new_mimetyp flash(u"Gespeichert.",True) return redirect(url_for("pybble.views.view_oid", oid=dest.oid)) elif request.method == 'GET': if obj: form.target.data = parent.oid if parent else obj.parent.oid form.user.data = obj.owner.oid form.for_objtyp.data = str(obj.for_objtyp.id) form.new_objtyp.data = str(obj.new_objtyp.id) if obj.new_objtyp else "-" form.new_mimetyp.data = str(obj.new_mimetyp.id) if obj.new_mimetyp else "-" form.inherit.data = "*" if obj.inherit is None else "Yes" if obj.inherit else "No" form.right.data = str(obj.right) else: form.target.data = parent.oid form.user.data = request.user.oid form.right.data = str(PERM_NONE) form.for_objtyp.data = str(parent.type_id) form.new_objtyp.data = "-" form.new_mimetyp.data = "-" form.inherit.data = "*" return render_template('edit/permission.html', parent=parent, obj=obj, form=form, title_trace=["New permission" if parent else "Edit permission"])
def view_tree(oid=None): if oid is None: obj = current_site else: obj = Object.by_oid(oid) request.user.will_admin(obj) if obj == current_site: title_trace=["Objects"] else: title_trace=[unicode(obj),"Objects"] return render_template('tree.html', obj=obj, title_trace=title_trace)
def object_list(model_slug): if model_slug not in models: abort(404) model = models[model_slug] field_names = model.__table__.columns.keys() primary_key = model.__table__.primary_key.columns.keys()[0] objects = model.q.all() context = { 'model_slug': model_slug, 'field_names': field_names, 'primary_key': primary_key, 'objects': objects, } return render_template('_admin/list.html', **context)
def confirm(code=None): if code is None: code = request.values.get("code", None) if code is None: form = ConfirmForm(request.values, prefix="confirm") if request.method != "POST" or not form.validate(): return render_template("confirm.html", form=form, title_trace=["Bestätigung"]) code = form.code.data.lower() v = Verifier.q.get_by(code=text_type(code)) if v.expired: flash("Die Anfrage ist schon zu alt. Bitte schicke sie nochmal ab!") return v.retry() return v.entered()
def editor(self, template=None, done=None, **kw): fields = self.obj.fieldset(parent=self.parent) if request.method == 'POST': fields.rebind(data=request.form) if fields.validate(): fields.sync() db.session.flush() if done is not None: return done() next_url = url_for('pybble.views.view_oid', oid=fields.model.oid) return redirect(next_url) if template is None: template = 'admin/new.html' if isinstance(self.obj,ObjType) else 'admin/edit.html' return render_template(template, fields=fields, obj=self.obj, _root=current_site, **kw)
def editor(obj=None, parent=None): form = WantTrackingForm(request.form, prefix="perm") if request.method == 'POST' and form.validate(): user = Object.by_oid(form.user.data) dest = Object.by_oid(form.object.data) objtyp = None if form.objtyp.data == "-" else int(form.objtyp.data) email = bool(form.email.data) track_new = bool(form.track_new.data) track_mod = bool(form.track_mod.data) track_del = bool(form.track_del.data) if parent: obj = WantTracking.new(user, dest, objtyp) else: obj.record_change() obj.owner = user obj.parent = dest obj.objtyp = objtyp obj.track_new=track_new obj.track_mod=track_mod obj.track_del=track_del obj.email=email flash(u"Gespeichert.",True) return redirect(url_for("pybble.views.view_oid", oid=(parent or dest).oid)) elif request.method == 'GET': if obj: # bearbeiten / kopieren form.object.data = parent.oid if parent else obj.parent.oid form.user.data = obj.owner.oid form.objtyp.data = str(obj.objtyp) form.track_new.data = obj.track_new form.track_mod.data = obj.track_mod form.track_del.data = obj.track_del form.email.data = obj.email else: form.object.data = parent.oid form.user.data = request.user.oid form.objtyp.data = "-" form.track_new.data = True form.track_mod.data = False form.track_del.data = False form.email.data = False return render_template('edit/wanttracking.html', obj=obj, parent=parent or obj.parent, form=form, title_trace=["Beobachten"])
def do_login(): form = LoginForm(request.form, prefix='login') error = "" user = getattr(request,"user",None) if user and not user.anon: flash(u"Du bist bereits eingeloggt!") return redirect((request.form or request.args or {}).get("next",None) or url_for("pybble.views.mainpage")) if request.method == 'POST' and form.validate(): # create new user and show the confirmation page try: u = User.q.get_by(username=form.username.data) except NoData: logger.warn("No user {} in {}".format(form.username.data,current_site)) u = None else: if not u.check_password(form.password.data): logger.warn("Wrong password of {} in {}".format(u,current_site)) u = None else: if not u.member_of(current_site) and not u.anon: logger.warn("Wrong user {} in {}".format(u,current_site)) u = None if u: logged_in(u) now = datetime.utcnow() if u.cur_login is None or u.cur_login < now-timedelta(0,600): u.last_login = u.cur_login or now u.cur_login = now if u.verified: flash(u"Du bist jetzt eingeloggt.",True) else: flash(u"Benutzer noch nicht verifiziert. Bitte gib den Code aus der Email an!",False) return redirect(url_for("pybble.confirm.confirm")) if form.next.data: return redirect(form.next.data) else: return redirect(url_for("pybble.views.mainpage")) else: flash(u"Username oder Passwort sind falsch.",False) elif request.method == 'GET': form.next.data = request.args.get("next","") return render_template('login.html', form=form, error=error, title_trace=["Login"])
def register(): form = RegisterForm(request.form, prefix='register') if request.method == 'POST' and form.validate(): u = User.new(form.username.data, form.password.data, anon=True) ## needs verification u.email = form.email.data u.parent = current_site verifier = VerifierBase.q.get_by(name="register") v = verifier.new(obj=current_site, user=u) v.send() flash(Markup(u"Wir haben soeben eine Email an dich geschickt. <br />" + \ u"Klicke auf den darin enhaltenen Link oder tippe den Bestätigungscode hier ein.")) return redirect(url_for("pybble.confirm.confirm")) form.password.data = form.password2.data = "" return render_template('register.html', form=form, title_trace=[u"Neuer Benutzer"])
def delete_oid(oid): obj=Object.by_oid(oid) request.user.will_delete(obj) form = DeleteForm(request.form, prefix='delete') if request.method == 'POST' and form.validate(): Delete.new(obj, comment=form.comment.data) flash(u"%s (%s) has been deleted" % (unicode(obj),obj.oid), True) if form.next.data: return redirect(form.next.data) elif obj.parent: return redirect(url_for("pybble.views.view_oid", oid=obj.parent.oid)) else: return redirect(url_for("pybble.views.mainpage")) return render_template('delete.html', form=form, title_trace=["Delete"], obj=obj)
def confirm(code=None): if code is None: code = request.values.get('code', None) if code is None: form = ConfirmForm(request.values, prefix='confirm') if request.method != 'POST' or not form.validate(): return render_template('confirm.html', form=form, title_trace=[u"Bestätigung"]) code = form.code.data.lower() v = Verifier.q.get_by(code=text_type(code)) if v.expired: flash(u"Die Anfrage ist schon zu alt. Bitte schicke sie nochmal ab!") return v.retry() return v.entered()
def editor(obj=None): form = FileForm(request.form, prefix="bindata") form.obj = obj if request.method == 'POST' and form.validate(): if obj.data != form.page.data: obj.record_change(comment=form.name.data) flash(u"Datei-Info '%s' geändert." % (obj.name), True) else: flash(u"Datei-Info '%s' unverändert." % (obj.name)) return redirect(url_for("pybble.views.view_oid", oid=obj.oid)) elif request.method == 'GET': form.name.data = obj.name if obj else name form.mime.daat = obj.mime_id return render_template('edit/bindata.html', obj=obj, form=form, name=form.name.data, title_trace=["Datei-Info editieren"])
def newer(parent, name=None): if parent is None: parent = request.site form = FileForm(request.form, prefix="bindata") try: form.bindata = request.files['bindata'] except (KeyError,AttributeError): pass if request.method == 'POST' and form.validate(): f = request.files['bindata'] data = f.read() obj = BinData.new(parent=parent, storage=parent.default_storage, name=form.name.data, content=data, mimetype=form.mimetype) flash(u"Daten '%s' gespeichert." % (obj.name), True) return redirect(url_for("pybble.views.view_oid", oid=obj.oid)) elif request.method == 'GET': pass return render_template('edit/bindata.html', parent=parent, form=form, name=form.name.data, title_trace=["Datei-Upload"])
def config_rss(): user = request.user if user.anon: flash("Du musst dich erst einloggen.") return redirect(url_for("pybble.login.do_login", next=url_for("pybble.rss.config_rss"))) form = RSSForm(request.form, prefix="rss") if request.method == 'POST' and form.validate(): user.feed_age = int(form.age.data) if form.new_id.data or not user.feed_pass: user.feed_pass = unicode(random_string(30)) flash(u"Gespeichert.",True) return redirect(url_for("pybble.views.mainpage")) elif request.method == 'GET': form.age.data = str(user.feed_age) new_feed = not user.has_trackers return render_template('rssconfig.html', form=form, title_trace=["RSS-Einstellungen"], new_feed=new_feed)
def editor(request, obj, parent=None): form = NamedTemplateForm(request.form, prefix="template") form.id = obj.id if request.method == 'POST' and form.validate(): if parent: obj = Template.new(form.name.data, form.page.data.replace("\r",""), parent=Object.by_oid(form.site.data)) obj.name = form.name.data else: obj.record_change() obj.parent = Object.by_oid(form.site.data) obj.name = form.name.data obj.data = form.page.data.replace("\r","") flash(u"Template '%s' gespeichert." % (form.name.data,), True) return redirect(url_for("pybble.admin.list_templates", oid=obj.parent.oid)) elif request.method == 'GET': form.site.data = parent.oid if parent else obj.parent.oid form.name.data = obj.name if obj else "" form.page.data = obj.data if obj else "" return render_template('edit/template.html', obj=obj, form=form, parent=parent, title_trace=[obj.name,"Template-Editor"])
def editor(request, obj=None, parent=None): form = GroupForm(request.form, prefix="perm") if request.method == 'POST' and form.validate(): name = form.name.data if parent is None: obj = Group.new(name=name, parent=parent) else: data = obj.data obj.name = name flash(u"Gespeichert.",True) return redirect(url_for("pybble.views.view_oid", oid=obj.oid)) elif request.method == 'GET': if obj: form.name.data = obj.name else: form.name.data = "" return render_template('edit/group.html', parent=parent, obj=obj, form=form, title_trace=["New Group" if parent else "Edit Group"])
def editor(self, template=None, done=None, **kw): fields = self.obj.fieldset(parent=self.parent) if request.method == 'POST': fields.rebind(data=request.form) if fields.validate(): fields.sync() db.session.flush() if done is not None: return done() next_url = url_for('pybble.views.view_oid', oid=fields.model.oid) return redirect(next_url) if template is None: template = 'admin/new.html' if isinstance( self.obj, ObjType) else 'admin/edit.html' return render_template(template, fields=fields, obj=self.obj, _root=current_site, **kw)
def editor(obj, name=None, parent=None): assert parent is None from pybble.core.models.site import App import pdb;pdb.set_trace() form = SiteEditForm(request.form, obj, prefix="site", app=current_site.app.oid, parent=parent.oid if parent else current_site.oid) form.id = obj.id form.app.choices = tuple((o.oid,str(o)) for o in App.q.all()) kids = set(obj.all_sites) form.parent.choices = tuple((o.oid,str(o)) for o in Site.q.all() if o not in kids) if request.method == 'POST' and form.validate(): obj.name = form.name.data obj.domain = form.domain.data obj.app = Object.by_oid(form.app.data) obj.parent = Object.by_oid(form.parent.data) return redirect(url_for("pybble.views.view_oid", oid=obj.oid)) elif request.method == 'GET': form.name.data = obj.name form.domain.data = obj.domain form.app.data = obj.app.oid form.parent.data = obj.parent.oid return render_template('edit/site.html', obj=obj, form=form, name=form.name.data, title_trace=["globale Einstellungen"])
def editor(request, obj=None, parent=None): form = MemberForm(request.form, prefix="perm") if request.method == 'POST' and form.validate(): user = Object.by_oid(form.user.data) group = Object.by_oid(form.group.data) excluded = bool(form.excluded.data) if parent: obj = Member.new(user, group) else: data = obj.data obj.owner = user obj.parent = group obj.excluded = excluded obj.record_change(data) flash(u"Gespeichert.", True) return redirect(url_for("pybble.views.view_oid", oid=user.oid)) elif request.method == 'GET': if obj: form.group.data = parent.oid if parent else obj.parent.oid form.user.data = obj.owner.oid form.excluded.data = obj.excluded else: form.user.data = request.user.oid form.group.data = parent.oid form.excluded.data = False return render_template( 'edit/member.html', parent=parent, obj=obj, form=form, title_trace=["New Member" if parent else "Edit Member"])
def editor(request, obj=None, parent=None): form = TemplateMatchForm(request.form, prefix="template") if not parent: form.id = obj.id if request.method == 'POST' and form.validate(): if form.inherit.data == "Yes": inherit = True elif form.inherit.data == "No": inherit = False elif form.inherit.data == "*": inherit = None else: assert False dest = Object.by_oid(form.oid.data) if parent: obj = TemplateMatch.new(parent,int(form.objtyp.data),int(form.detail.data),form.page.data.replace("\r","")) else: obj.record_change() obj.data = form.page.data.replace("\r","") obj.objtyp = int(form.objtyp.data) obj.detail = int(form.detail.data) obj.inherit = inherit db.store.flush() flash(u"Gespeichert.",True) # Now filter other templates to look for overlaps m = [ TemplateMatch.objtyp == obj.objtyp, TemplateMatch.detail == obj.detail, TemplateMatch.obj_id == obj.id ] if obj.inherit is None: m.append(TemplateMatch.inherit != None) else: m.append(TemplateMatch.inherit == None) m = db.store.find(TemplateMatch,And(*m)) if obj.inherit is None: if m.count(): flash(u"Vorherige Assoziation(en) entfernt.") for mm in m: db.store.remove(mm) else: if m.count(): flash(u"Bestehende Assoziation eingeschränkt.") for mm in m: mm.inherit = not obj.inherit return redirect(url_for("pybble.views.view_oid", oid=dest.oid)) elif request.method == 'GET': if obj: form.page.data = obj.data form.objtyp.data = str(obj.objtyp) form.detail.data = str(obj.detail) form.inherit.data = "*" if obj.inherit is None else "Yes" if obj.inherit else "No" else: form.detail.data = str(TM_DETAIL_PAGE) form.objtyp.data = str(parent.objtyp) form.inherit.data = "*" if parent: form.oid.data = parent.oid else: form.oid.data = obj.parent.oid return render_template('edit/templatematch.html', obj=obj, parent=parent, form=form, title_trace=["Template-Editor"])
def test_var(var): """… and insert some data""" return render_template('BlueTest/var.html', fubar=var)
def test_blue(): """Fetch template by SiteBlueprint name""" return render_template('BlueTest/blue.html')
def test_green(): """Fetch template by blueprint name""" return render_template('_test/green.haml')
def last_visited(): return render_template("last_visited.html", q=request.user.all_visited(), title_trace=[u"zuletzt besucht"])
def view_snippet(oid,k=None): """Return a list of fields in this object, and references to it""" obj = Object.by_oid(oid) return render_template("snippet1.html", obj=obj, key=k, sub=list(obj.count_refs()), _root=current_site)
def not_found(url=None): return render_template('not_found.html', title_trace=[u"Seite nicht gefunden"])
def not_allowed(obj, perm=None): return render_template('not_allowed.html', title_trace=[u"Keine Berechtigung"], obj=obj, perm=perm)
def not_able(obj, perm=None): return render_template('not_able.html', title_trace=[u"Das geht nicht"], obj=obj, perm=perm)
def show_permission(permission=None): p = Object.by_oid(permission) return render_template('permissionlist.html', obj=p, title_trace=["Permissions"])
def view_snippet2(oid, objtyp,k): obj = Object.by_oid(oid) objtyp = ObjType.get(objtyp) sub=list(obj.get_refs(objtyp,k)) return render_template("snippet2.html", cls=objtyp, obj=obj, sub=sub, k=k, count=len(sub), _root=current_site)
def editor(request, obj=None, parent=None): form = TemplateMatchForm(request.form, prefix="template") if not parent: form.id = obj.id if request.method == 'POST' and form.validate(): if form.inherit.data == "Yes": inherit = True elif form.inherit.data == "No": inherit = False elif form.inherit.data == "*": inherit = None else: assert False dest = Object.by_oid(form.oid.data) if parent: obj = TemplateMatch.new(parent, int(form.objtyp.data), int(form.detail.data), form.page.data.replace("\r", "")) else: obj.record_change() obj.data = form.page.data.replace("\r", "") obj.objtyp = int(form.objtyp.data) obj.detail = int(form.detail.data) obj.inherit = inherit db.store.flush() flash(u"Gespeichert.", True) # Now filter other templates to look for overlaps m = [ TemplateMatch.objtyp == obj.objtyp, TemplateMatch.detail == obj.detail, TemplateMatch.obj_id == obj.id ] if obj.inherit is None: m.append(TemplateMatch.inherit != None) else: m.append(TemplateMatch.inherit == None) m = db.store.find(TemplateMatch, And(*m)) if obj.inherit is None: if m.count(): flash(u"Vorherige Assoziation(en) entfernt.") for mm in m: db.store.remove(mm) else: if m.count(): flash(u"Bestehende Assoziation eingeschränkt.") for mm in m: mm.inherit = not obj.inherit return redirect(url_for("pybble.views.view_oid", oid=dest.oid)) elif request.method == 'GET': if obj: form.page.data = obj.data form.objtyp.data = str(obj.objtyp) form.detail.data = str(obj.detail) form.inherit.data = "*" if obj.inherit is None else "Yes" if obj.inherit else "No" else: form.detail.data = str(TM_DETAIL_PAGE) form.objtyp.data = str(parent.objtyp) form.inherit.data = "*" if parent: form.oid.data = parent.oid else: form.oid.data = obj.parent.oid return render_template('edit/templatematch.html', obj=obj, parent=parent, form=form, title_trace=["Template-Editor"])