Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _create_index_for_attribute(name_or_all, index_type, recreate=False):
from schema.schema import Metafield
creation_func = getattr(mediatumfunc, "create_attrindex_" + index_type)
if name_or_all == "all":
# find all search / sort metafields
if index_type == "search":
flags = "%s%"
elif index_type == "sort":
flags = "%o%"
metafield_names = (t[0] for t in q(Metafield.name).filter(Metafield.a.opts.like(flags)).distinct())
created_indices = []
failed_indices = []
for attrname in metafield_names:
try:
created = exec_sqlfunc(s, creation_func(attrname, recreate))
except sqlalchemy.exc.OperationalError:
logg.exception("failed to create %s index for %s", index_type, attrname)
s.rollback()
failed_indices.append(attrname)
else:
if created:
s.commit()
created_indices.append(attrname)
logg.info("created %s indices for %s attributes, %s failed: %s",
field = Metafield("from")
field.set("label", t(lang, "admin_wfstep_checkcontent_sender"))
field.set("type", "text")
ret.append(field)
field = Metafield("email")
field.set("label", t(lang, "admin_wfstep_checkcontent_recipient"))
field.set("type", "text")
ret.append(field)
field = Metafield("subject")
field.set("label", t(lang, "admin_wfstep_checkcontent_subject"))
field.set("type", "text")
ret.append(field)
field = Metafield("text")
field.set("label", t(lang, "admin_wfstep_checkcontent_text"))
field.set("type", "memo")
ret.append(field)
return ret
def metaFields(self, lang=None):
metafields = Container.metaFields(self, lang=lang)
field = Metafield(u"style_hide_empty")
field.set("label", t(lang, "hide empty directories"))
field.set("type", u"check")
metafields.append(field)
return metafields
def metaFields(self, lang=None):
ret = []
field = Metafield("from")
field.set("label", t(lang, "admin_wfstep_checkcontent_sender"))
field.set("type", "text")
ret.append(field)
field = Metafield("email")
field.set("label", t(lang, "admin_wfstep_checkcontent_recipient"))
field.set("type", "text")
ret.append(field)
field = Metafield("subject")
field.set("label", t(lang, "admin_wfstep_checkcontent_subject"))
field.set("type", "text")
ret.append(field)
field = Metafield("text")
field.set("label", t(lang, "admin_wfstep_checkcontent_text"))
field.set("type", "memo")
ret.append(field)
return ret
def metaFields(self, lang=None):
ret = list()
field = Metafield("upload_pdfform")
field.set("label", t(lang, "workflowstep-addformpage_label_upload_pdfform"))
field.set("type", "upload")
ret.append(field)
field = Metafield("pdf_fields_editable")
field.set("label", t(lang, "workflowstep-addformpage_label_pdf_fields_editable"))
field.set("type", "check")
ret.append(field)
field = Metafield("pdf_form_separate")
field.set("label", t(lang, "workflowstep-addformpage_label_pdf_form_separate"))
field.set("type", "check")
ret.append(field)
field = Metafield("pdf_form_overwrite")
field.set("label", t(lang, "workflowstep-addformpage_label_pdf_overwrite"))
field.set("type", "check")
ret.append(field)
return ret
def metaFields(self, lang=None):
ret = list()
field = Metafield("publishsetpublishedversion")
field.set("label", t(lang, "admin_wfstep_publishsetpublishedversion"))
field.set("type", "check")
ret.append(field)
field = Metafield("publishsetupdatetime")
field.set("label", t(lang, "admin_wfstep_publishsetupdatetime"))
field.set("type", "check")
ret.append(field)
return ret
def metaFields(self, lang=None):
ret = []
field = Metafield("endtext")
field.set("label", t(lang, "admin_wfstep_endtext"))
field.set("type", "memo")
ret.append(field)
field = Metafield("endremove")
field.set("label", t(lang, "admin_wfstep_endremove"))
field.set("type", "check")
ret.append(field)
field = Metafield("endsetupdatetime")
field.set("label", t(lang, "admin_wfstep_endsetupdatetime"))
field.set("type", "check")
ret.append(field)
return ret
def metaFields(self, lang=None):
metafields = []
field = Metafield(u"nodename", attrs={
"label": t(lang, "node name"),
"type": u"text"
})
metafields.append(field)
field = Metafield(u"style_full", attrs={
"label": t(lang, "full view style"),
"type": u"list",
"valuelist": u"full_standard;full_text"
})
metafields.append(field)
field = Metafield(u"style", attrs={
"label": t(lang, "style"),
"type": u"list",
"valuelist": u"thumbnail;list;text",
def metaFields(self, lang=None):
ret = []
field = Metafield("endtext")
field.set("label", t(lang, "admin_wfstep_endtext"))
field.set("type", "memo")
ret.append(field)
field = Metafield("endremove")
field.set("label", t(lang, "admin_wfstep_endremove"))
field.set("type", "check")
ret.append(field)
field = Metafield("endsetupdatetime")
field.set("label", t(lang, "admin_wfstep_endsetupdatetime"))
field.set("type", "check")
ret.append(field)
return ret