コード例 #1
0
from zope.schema._bootstrapinterfaces import ConstraintNotSatisfied
from zope.schema._bootstrapinterfaces import IFromUnicode
from zope.schema.interfaces import IChoice
from zope.schema.interfaces import ICollection
from zope.schema.interfaces import IDate
from zope.schema.interfaces import IDatetime
from zope.schema.interfaces import IInterfaceField
from zope.schema.interfaces import IObject
from zope.schema.interfaces import IVocabularyFactory

import inspect
import json
import os
import plone.supermodel

configure.include(package=plone.supermodel)

configure.browser.resource(
    name='schemaeditor.js',
    file=os.path.join('browser/schemaeditor.js'),
)


@configure.adapter.factory()
@adapter(IDate, IDateWidget)
@implementer(IDataConverter)
class AccessibleDateWidgetConverter(DateWidgetConverter):
    def toFieldValue(self, value):
        try:
            return super(AccessibleDateWidgetConverter,
                         self).toFieldValue(value, )
コード例 #2
0
    id=u'flow.AuthorPortalContent',
    title=u'collective.flow: Author portal content',
)

scan(behaviors)
scan(buttons)
scan(comments)
scan(content)
scan(defaults)
scan(fields)
scan(history)
scan(schema)
scan(subfolder)
scan(transforms)

configure.include(package=browser, file='__init__.py')

if has_package('plone.restapi'):
    from collective.flow import restapi
    import plone.rest
    configure.include(package=plone.rest, file='meta.zcml')
    scan(restapi)


@configure.gs.registerProfile.post_handler(
    name=u'default',
    title=_(u'Forms, workflows and everything'),
    description=_(u'Activates collective.flow'),
    directory=u'profiles/default',
    provides=u'Products.GenericSetup.interfaces.EXTENSION',
)
コード例 #3
0
# -*- coding: utf-8 -*-
"""
This module scans all direct submodules for component registrations in this
package when included for zope.configuration with venusianconfiguration.

"""
from transmogrifier_ploneblueprints import pipelines
from venusianconfiguration import configure
from venusianconfiguration import scan

import importlib
import os
import pkg_resources


# Scan modules
for resource in pkg_resources.resource_listdir(__package__, ''):
    name, ext = os.path.splitext(resource)
    if ext == '.py' and name not in ('__init__', 'configure', 'testing'):
        path = '{0:s}.{1:s}'.format(__package__, name)
        scan(importlib.import_module(path))


configure.include(package=pipelines, file='configure.py')
コード例 #4
0
scan(views)
scan(adapters)

configure.meta.provides(feature='demofeature')

configure.browser.page(
    name='hello-world-template',
    for_='*',
    template='templates/hello_world.pt',
    permission='zope2.View',
    condition='have demofeature'
)

configure.include(
    package='.portlets',
    file_='configure.py'
)

with configure(package=viewlets) as subconfigure:
    subconfigure.browser.viewlet(
        name='plone.logo',
        manager=IPortalHeader,
        klass=LogoViewlet,
        template='logo.pt',
        layer=IVenusianConfigDemoLayer,
        permission='zope2.View'
    )

configure.gs.registerProfile(
    name='default',
    title=_(u'Demonstration of venusian-configuration'),
コード例 #5
0
# -*- coding: utf-8 -*-
from venusianconfiguration import i18n_domain
from venusianconfiguration import configure
from venusianconfigdemo.portlets import venusianportlet

i18n_domain('venusianconfigdemo')

configure.include(package='plone.app.portlets')

configure.plone.portlet(
    name='venusianconfigdemo.venusianportlet',
    interface=venusianportlet.IVenusianPortlet,
    renderer=venusianportlet.Renderer,
    assignment=venusianportlet.Assignment,
    addview=venusianportlet.AddForm,
    editview=venusianportlet.EditForm
)
コード例 #6
0
# -*- coding: utf-8 -*-
"""
This module scans all direct submodules for component registrations in this
package when included for zope.configuration with venusianconfiguration.

"""
import importlib
import os

import pkg_resources
from venusianconfiguration import configure
from venusianconfiguration import scan


# Scan modules
for resource in pkg_resources.resource_listdir(__package__, ''):
    name, ext = os.path.splitext(resource)
    if ext == '.py' and name not in ('__init__', 'configure', 'testing'):
        path = '{0:s}.{1:s}'.format(__package__, name)
        scan(importlib.import_module(path))

from transmogrifier_ploneblueprints import pipelines
configure.include(package=pipelines, file='configure.py')
コード例 #7
0
def marshall(self, instance, **kwargs):
    message = constructMessage(instance, iterFields(instance))
    content_type = message.get_content_type()
    data = to_string(message)
    length = len(data)
    return content_type, length, data


# noinspection PyUnusedLocal
def demarshall(self, instance, data, **kwargs):
    message = message_from_string(data)
    initializeObject(instance, iterFields(instance), message)


import collective.monkeypatcher
configure.include(package=collective.monkeypatcher)

configure.monkey.patch(
    description=u'Patch Archetype RFC822Marshaller',
    class_='Products.Archetypes.Marshall.RFC822Marshaller',
    original='marshall',
    replacement='.marshaler.marshall'
)

configure.monkey.patch(
    description=u'Patch Archetypes RFC822Marshaller',
    class_='Products.Archetypes.Marshall.RFC822Marshaller',
    original='demarshall',
    replacement='.marshaler.demarshall'
)
コード例 #8
0
    return out.getvalue()


# noinspection PyUnusedLocal
def marshall(self, instance, **kwargs):
    message = constructMessage(instance, iterFields(instance))
    content_type = message.get_content_type()
    data = to_string(message)
    length = len(data)
    return content_type, length, data


# noinspection PyUnusedLocal
def demarshall(self, instance, data, **kwargs):
    message = message_from_string(data)
    initializeObject(instance, iterFields(instance), message)


import collective.monkeypatcher
configure.include(package=collective.monkeypatcher)

configure.monkey.patch(description=u'Patch Archetype RFC822Marshaller',
                       class_='Products.Archetypes.Marshall.RFC822Marshaller',
                       original='marshall',
                       replacement='.marshaler.marshall')

configure.monkey.patch(description=u'Patch Archetypes RFC822Marshaller',
                       class_='Products.Archetypes.Marshall.RFC822Marshaller',
                       original='demarshall',
                       replacement='.marshaler.demarshall')
コード例 #9
0
# -*- coding: utf-8 -*-
from venusianconfiguration import (configure, scan)

import plone.behavior
import plone.app.dexterity

from example.uidattrbehavior import behaviors

from zope.i18nmessageid import MessageFactory
_ = MessageFactory('example.uidattrbehavior')

configure.include(package=plone.app.dexterity)
configure.include(package=plone.behavior, file_='meta.zcml')

configure.i18n.registerTranslations(directory='locales')

scan(behaviors)

configure.gs.registerProfile(
    name=u'default',
    title=_(u'UID Attr Behavior'),
    description=_(u'Provides UID attr for Dexterity content objects'),
    directory=u'profiles/default',
    provides=u'Products.GenericSetup.interfaces.EXTENSION')
コード例 #10
0
# -*- coding: utf-8 -*-
from venusianconfiguration import (
    configure,
    scan
)

import plone.behavior
import plone.app.dexterity

from example.uidattrbehavior import behaviors

from zope.i18nmessageid import MessageFactory
_ = MessageFactory('example.uidattrbehavior')

configure.include(package=plone.app.dexterity)
configure.include(package=plone.behavior, file_='meta.zcml')

configure.i18n.registerTranslations(directory='locales')

scan(behaviors)

configure.gs.registerProfile(
    name=u'default',
    title=_(u'UID Attr Behavior'),
    description=_(u'Provides UID attr for Dexterity content objects'),
    directory=u'profiles/default',
    provides=u'Products.GenericSetup.interfaces.EXTENSION'
)