예제 #1
0
파일: metaconfigure.py 프로젝트: a25kk/stv2
def EditViewFactory(name, schema, label, permission, layer,
                    template, default_template, bases, for_, fields,
                    fulledit_path=None, fulledit_label=None, menu=u''):
    class_ = makeClassForTemplate(template, globals(), used_for=schema,
                                  bases=bases)
    class_.schema = schema
    class_.label = label
    class_.fieldNames = fields

    class_.fulledit_path = fulledit_path
    if fulledit_path and (fulledit_label is None):
        fulledit_label = "Full edit"

    class_.fulledit_label = fulledit_label

    class_.generated_form = ZopeTwoPageTemplateFile(default_template)

    if layer is None:
        layer = IDefaultBrowserLayer

    s = zapi.getGlobalSiteManager()
    s.provideAdapter((for_, layer), Interface, name, class_)

    # Reminder: the permission we got has already been processed by
    # BaseFormDirective, that means that zope.Public has been
    # translated to the CheckerPublic object
    protectClass(class_, permission)
    initializeClass(class_)
예제 #2
0
def EditViewFactory(name,
                    schema,
                    label,
                    permission,
                    layer,
                    template,
                    default_template,
                    bases,
                    for_,
                    fields,
                    fulledit_path=None,
                    fulledit_label=None,
                    menu=u''):
    s = getGlobalService(Presentation)
    class_ = makeClassForTemplate(template,
                                  globals(),
                                  used_for=schema,
                                  bases=bases)
    class_.schema = schema
    class_.label = label
    class_.fieldNames = fields

    class_.fulledit_path = fulledit_path
    if fulledit_path and (fulledit_label is None):
        fulledit_label = "Full edit"

    class_.fulledit_label = fulledit_label

    class_.generated_form = ZopeTwoPageTemplateFile(default_template)

    s.provideView(for_, name, IBrowserRequest, class_, layer)
    protectClass(class_, permission)
    initializeClass(class_)
예제 #3
0
파일: metaconfigure.py 프로젝트: a25kk/stv2
def AddViewFactory(name, schema, label, permission, layer,
                   template, default_template, bases, for_,
                   fields, content_factory, arguments,
                   keyword_arguments, set_before_add, set_after_add,
                   menu=u''):
    class_ = makeClassForTemplate(template, globals(), used_for=schema,
                                  bases=bases)

    class_.schema = schema
    class_.label = label
    class_.fieldNames = fields
    class_._factory = content_factory
    class_._arguments = arguments
    class_._keyword_arguments = keyword_arguments
    class_._set_before_add = set_before_add
    class_._set_after_add = set_after_add

    class_.generated_form = ZopeTwoPageTemplateFile(default_template)

    if layer is None:
        layer = IDefaultBrowserLayer

    s = zapi.getGlobalSiteManager()
    s.provideAdapter((for_, layer), Interface, name, class_)

    # Reminder: the permission we got has already been processed by
    # BaseFormDirective, that means that zope.Public has been
    # translated to the CheckerPublic object
    protectClass(class_, permission)
    initializeClass(class_)
예제 #4
0
def AddViewFactory(name, schema, label, permission, layer,
                   template, default_template, bases, for_,
                   fields, content_factory, arguments,
                   keyword_arguments, set_before_add, set_after_add,
                   menu=u''):
    class_ = makeClassForTemplate(template, globals(), used_for=schema,
                                  bases=bases)

    class_.schema = schema
    class_.label = label
    class_.fieldNames = fields
    class_._factory = content_factory
    class_._arguments = arguments
    class_._keyword_arguments = keyword_arguments
    class_._set_before_add = set_before_add
    class_._set_after_add = set_after_add

    class_.generated_form = ZopeTwoPageTemplateFile(default_template)

    if layer is None:
        layer = IDefaultBrowserLayer

    s = zope.component.getGlobalSiteManager()
    s.registerAdapter(class_, (for_, layer), Interface, name)

    # Reminder: the permission we got has already been processed by
    # BaseFormDirective, that means that zope.Public has been
    # translated to the CheckerPublic object
    protectClass(class_, permission)
    initializeClass(class_)
예제 #5
0
def EditViewFactory(name, schema, label, permission, layer,
                    template, default_template, bases, for_, fields,
                    fulledit_path=None, fulledit_label=None, menu=u''):
    class_ = makeClassForTemplate(template, globals(), used_for=schema,
                                  bases=bases)
    class_.schema = schema
    class_.label = label
    class_.fieldNames = fields

    class_.fulledit_path = fulledit_path
    if fulledit_path and (fulledit_label is None):
        fulledit_label = "Full edit"

    class_.fulledit_label = fulledit_label

    class_.generated_form = ZopeTwoPageTemplateFile(default_template)

    if layer is None:
        layer = IDefaultBrowserLayer

    s = zope.component.getGlobalSiteManager()
    s.registerAdapter(class_, (for_, layer), Interface, name)

    # Reminder: the permission we got has already been processed by
    # BaseFormDirective, that means that zope.Public has been
    # translated to the CheckerPublic object
    protectClass(class_, permission)
    initializeClass(class_)
예제 #6
0
def make_view_w_macro(tal, bases=(), name='template class', **cdict):
    """
    for testing purposes
    """
    import os
    import tempfile
    fd, filename = tempfile.mkstemp()
    fh = os.fdopen(fd, 'w')
    print >> fh, tal
    return makeClassForTemplate(filename, bases=bases, cdict=cdict, name=name)
예제 #7
0
def EditViewFactory(name, schema, label, permission, layer,
                    template, default_template, bases, for_, fields,
                    fulledit_path=None, fulledit_label=None, menu=u''):
    s = getGlobalService(Presentation)
    class_ = makeClassForTemplate(template, globals(), used_for=schema,
                                  bases=bases)
    class_.schema = schema
    class_.label = label
    class_.fieldNames = fields

    class_.fulledit_path = fulledit_path
    if fulledit_path and (fulledit_label is None):
        fulledit_label = "Full edit"

    class_.fulledit_label = fulledit_label

    class_.generated_form = ZopeTwoPageTemplateFile(default_template)


    s.provideView(for_, name, IBrowserRequest, class_, layer)
    protectClass(class_, permission)
    initializeClass(class_)
예제 #8
0
def AddViewFactory(name,
                   schema,
                   label,
                   permission,
                   layer,
                   template,
                   default_template,
                   bases,
                   for_,
                   fields,
                   content_factory,
                   arguments,
                   keyword_arguments,
                   set_before_add,
                   set_after_add,
                   menu=u''):

    s = getGlobalService(Presentation)
    class_ = makeClassForTemplate(template,
                                  globals(),
                                  used_for=schema,
                                  bases=bases)

    class_.schema = schema
    class_.label = label
    class_.fieldNames = fields
    class_._factory = content_factory
    class_._arguments = arguments
    class_._keyword_arguments = keyword_arguments
    class_._set_before_add = set_before_add
    class_._set_after_add = set_after_add

    class_.generated_form = ZopeTwoPageTemplateFile(default_template)

    s.provideView(for_, name, IBrowserRequest, class_, layer)
    protectClass(class_, permission)
    initializeClass(class_)
예제 #9
0
def AddViewFactory(name, schema, label, permission, layer,
                   template, default_template, bases, for_,
                   fields, content_factory, arguments,
                   keyword_arguments, set_before_add, set_after_add,
                   menu=u''):

    s = getGlobalService(Presentation)
    class_ = makeClassForTemplate(template, globals(), used_for=schema,
                                  bases=bases)

    class_.schema = schema
    class_.label = label
    class_.fieldNames = fields
    class_._factory = content_factory
    class_._arguments = arguments
    class_._keyword_arguments = keyword_arguments
    class_._set_before_add = set_before_add
    class_._set_after_add = set_after_add

    class_.generated_form = ZopeTwoPageTemplateFile(default_template)

    s.provideView(for_, name, IBrowserRequest, class_, layer)
    protectClass(class_, permission)
    initializeClass(class_)