Esempio n. 1
0
from memphisttw.schema.interfaces import ISchema, ISchemaManagement

import pagelets, ttwschema
from configlet import SchemaFactory


config.action(view.registerDefaultView, "index.html", IField)

config.action(view.registerDefaultView, "index.html", ISchema)

config.action(view.registerDefaultView, "index.html", ISchemaManagement)


config.action(
    view.registerActions,
    ("index.html", IField, _("Edit"), _("Field edit form."), 10),
    ("preview.html", IField, _("Preview"), _("Field preview."), 20),
    ("../index.html", IField, _("Schema"), _("Return back to schema."), 30),
)


config.action(
    view.registerActions,
    ("index.html", ISchema, _("View"), _("View schema."), 10),
    ("edit.html", ISchema, _("Edit"), _("Modify ttw schema."), 20),
    ("preview.html", ISchema, _("Preview"), _("Schema creaview."), 30),
)


class ConfigletView(form.Form, view.View):
    view.pyramidView(
Esempio n. 2
0
 def handleTestSchema(self, action):
     data, errors = self.extractData()
     if errors:
         view.addMessage(self.request, self.formErrorsMessage, "error")
     else:
         view.addMessage(self.request, _("Schema has been processed successfully."))
Esempio n. 3
0
            if fld.__class__ == schema.Field:
                continue

            wschema._InterfaceClass__attrs[name] = fld

        return wschema

    @interface.implementer(IFieldFactory)
    def getFactory(self, *args):
        return self


# Boolean
Bool = FieldFactory(
    'boolean', schema.Bool, schema.interfaces.IBool,
    title = _("Boolean"),
    description = _("Boolean field (YES or NO)."))

config.action(
    config.registerAdapter, Bool.getFactory, (ISchema,), name=Bool.name)

config.action(
    config.registerAdapter, Bool.getFactory, (schema.interfaces.IBool,))


# Integer
Int = FieldFactory(
    'int', schema.Int, schema.interfaces.IInt,
    title = _("Integer"),
    description = _("Field containing an Integer Value."))