Ejemplo n.º 1
0
def initialize(context):

    # register directory views
    registerDirectory(SKINS_DIR, GLOBALS)

    # Register kss extension to allow it used from fs skins
    registerFileExtension('kss', FSFile)
Ejemplo n.º 2
0
def initialize(context):
    from Products.CMFCore import utils

    utils.ToolInit("%s Tool" % PKG_NAME, tools=tools,
                   icon="tool.gif",
                   ).initialize(context)

    if REGISTER_DEMO_TYPES:
        import Products.Archetypes.examples

        content_types, constructors, ftis = process_types(
            listTypes(PKG_NAME), PKG_NAME)

        utils.ContentInit(
            '%s Content' % PKG_NAME,
            content_types=content_types,
            permission=permissions.AddPortalContent,
            extra_constructors=constructors,
            fti=ftis,
            ).initialize(context)
    try:
        from Products.CMFCore.FSFile import FSFile
        from Products.CMFCore.DirectoryView import registerFileExtension
        registerFileExtension('xsl', FSFile)
        registerFileExtension('xul', FSFile)
    except ImportError:
        pass
Ejemplo n.º 3
0
def initialize(context):
    from Products.CMFCore import utils

    utils.ToolInit(
        "%s Tool" % PKG_NAME,
        tools=tools,
        icon="tool.gif",
    ).initialize(context)

    if REGISTER_DEMO_TYPES:
        import Products.Archetypes.examples

        content_types, constructors, ftis = process_types(
            listTypes(PKG_NAME), PKG_NAME)

        utils.ContentInit(
            '%s Content' % PKG_NAME,
            content_types=content_types,
            permission=permissions.AddPortalContent,
            extra_constructors=constructors,
            fti=ftis,
        ).initialize(context)
    try:
        from Products.CMFCore.FSFile import FSFile
        from Products.CMFCore.DirectoryView import registerFileExtension
        registerFileExtension('xsl', FSFile)
        registerFileExtension('xul', FSFile)
    except ImportError:
        pass
Ejemplo n.º 4
0
def initialize(context):
    """Initializer called when used as a Zope 2 product."""

    # Register SVG File Extensions for CMF
    from Products.CMFCore.DirectoryView import registerFileExtension
    from Products.CMFCore.FSFile import FSFile

    registerFileExtension('svg', FSFile)
Ejemplo n.º 5
0
def initialize(context):
    """Initializer called when used as a Zope 2 product."""

    # Register SVG File Extensions for CMF
    from Products.CMFCore.DirectoryView import registerFileExtension
    from Products.CMFCore.FSFile import FSFile

    registerFileExtension("svg", FSFile)
Ejemplo n.º 6
0
def setupPackage():
    metaconfigure.debug_mode = True
    import Products.ResourceRegistries.tests
    load_config('test.zcml', Products.ResourceRegistries.tests)
    metaconfigure.debug_mode = False

    from Products.CMFCore.DirectoryView import registerFileExtension
    from Products.CMFCore.FSFile import FSFile
    registerFileExtension('kss', FSFile)
Ejemplo n.º 7
0
def setupPackage():
    metaconfigure.debug_mode = True
    import Products.ResourceRegistries.tests
    load_config('test.zcml', Products.ResourceRegistries.tests)
    metaconfigure.debug_mode = False

    from Products.CMFCore.DirectoryView import registerFileExtension
    from Products.CMFCore.FSFile import FSFile
    registerFileExtension('kss', FSFile)
def initialize(context):

    manager = getSiteManager(context)
    manager.registerUtility(factory=SubprocessCoffeeCompiler)

    # Register coffee extension to allow it to be used from FS skins
    registerFileExtension('coffee', FSFile)

    TOOLS = (
        CoffeeRegistryTool,
    )

    ToolInit(
        config.PROJECTNAME + ' Tool',
        tools = TOOLS,
        icon = 'tool.gif',
    ).initialize(context)
Ejemplo n.º 9
0
def initialize(context):

    # register directory views
    registerDirectory(SKINS_DIR, GLOBALS)
    
    # Register kss extension to allow it used from fs skins
    registerFileExtension('kss', FSFile)

    # content initialization
    content_types, constructors, ftis = process_types( 
        listTypes(PROJECTNAME),
        PROJECTNAME)

    utils.ContentInit(
        PROJECTNAME + ' Content',
        content_types = content_types,
        permission = ADD_CONTENT_PERM,
        extra_constructors = constructors,
        ).initialize(context)
Ejemplo n.º 10
0
def initialize(context):

    # Stuff has been moved from module level to this method for a
    # better separation of import and installation.
    # For the general user this change does not make a difference.
    # For test authors (and people who use parts of Plone only)
    # it does speed up import *significantly*.

    from AccessControl import ModuleSecurityInfo
    from AccessControl import allow_module, allow_class

    # allow logging
    ModuleSecurityInfo('logging').declarePublic('getLogger')
    from logging import Logger
    allow_class(Logger)

    # Register kss extension to allow it used from fs skins
    from Products.CMFCore.DirectoryView import registerFileExtension
    from Products.CMFCore.FSFile import FSFile
    registerFileExtension('kss', FSFile)

    # various small utils functions
    # added for unescaping view names in urls when finding selected action
    ModuleSecurityInfo('urllib').declarePublic('unquote')

    allow_module('Products.CMFPlone.utils')

    # For content_status_modify
    from Products.CMFCore.WorkflowCore import ObjectMoved, ObjectDeleted, \
                                              WorkflowException
    ModuleSecurityInfo('Products.CMFCore.WorkflowCore').declarePublic(
        'ObjectMoved')
    ModuleSecurityInfo('Products.CMFCore.WorkflowCore').declarePublic(
        'ObjectDeleted')
    ModuleSecurityInfo('Products.CMFCore.WorkflowCore').declarePublic(
        'WorkflowException')
    allow_class(ObjectMoved)
    allow_class(ObjectDeleted)
    allow_class(WorkflowException)

    from PloneBatch import Batch
    allow_class(Batch)

    # Make Batch available at module level
    this_module.Batch = Batch

    from StringIO import StringIO
    allow_class(StringIO)

    # Make Unauthorized importable TTW
    ModuleSecurityInfo('AccessControl').declarePublic('Unauthorized')

    # Make Forbidden importable TTW
    ModuleSecurityInfo('zExceptions').declarePublic('Forbidden')

    # Make ConflictError importable TTW
    ModuleSecurityInfo('ZODB.POSException').declarePublic('ConflictError')

    # Make ZCTextIndex ParseError importable TTW
    ModuleSecurityInfo('Products.ZCTextIndex.ParseTree').declarePublic(
        'ParseError')

    # Make DateTimeError importable TTW
    ModuleSecurityInfo('DateTime.interfaces').declarePublic('DateTimeError')
    ModuleSecurityInfo('DateTime.interfaces').declarePublic('SyntaxError')

    # BBB support for DateTime < 3
    ModuleSecurityInfo('DateTime.DateTime').declarePublic('DateTimeError')
    ModuleSecurityInfo('DateTime.DateTime').declarePublic('SyntaxError')

    # Make CopyError importable TTW
    ModuleSecurityInfo('OFS.CopySupport').declarePublic('CopyError')

    # Make DiscussionNotAllowed importable TTW
    ModuleSecurityInfo('Products.CMFDefault.DiscussionTool').declarePublic(
        'DiscussionNotAllowed')

    # Make AllowSendto importable TTW
    ModuleSecurityInfo('Products.CMFPlone.PloneTool').declarePublic(
        'AllowSendto')

    # Make ZCatalog's mergeResults importable TTW
    ModuleSecurityInfo('Products.ZCatalog.Catalog').declarePublic(
        'mergeResults')

    # Make the navtree constructs available TTW
    allow_module('Products.CMFPlone.browser.navtree')

    # Allow access to the exception in the folder_delete script
    from OFS.ObjectManager import BeforeDeleteException
    allow_module('OFS.ObjectManager')
    allow_class(BeforeDeleteException)

    # Make cgi.escape available TTW
    ModuleSecurityInfo('cgi').declarePublic('escape')

    # Apply monkey patches
    import patches

    # Register unicode splitter w/ ZCTextIndex
    # pipeline registry
    import UnicodeSplitter

    # Plone content

    # Usage of PloneFolder is discouraged.
    import PloneFolder

    contentClasses = (PloneFolder.PloneFolder, )
    contentConstructors = (PloneFolder.addPloneFolder, )

    # CMFCore and CMFDefault tools
    from Products.CMFCore import CachingPolicyManager

    # Plone tools
    import PloneTool
    import FactoryTool
    import InterfaceTool
    import MigrationTool
    import PloneControlPanel
    import WorkflowTool
    import URLTool
    import MetadataTool
    import RegistrationTool
    import SyndicationTool
    import PropertiesTool
    import ActionsTool
    import TypesTool
    import UndoTool
    import CatalogTool
    import SkinsTool
    import DiscussionTool
    import CalendarTool
    import ActionIconsTool
    import QuickInstallerTool
    import TranslationServiceTool

    tools = (
        PloneTool.PloneTool,
        WorkflowTool.WorkflowTool,
        CachingPolicyManager.CachingPolicyManager,
        FactoryTool.FactoryTool,
        PropertiesTool.PropertiesTool,
        MigrationTool.MigrationTool,
        InterfaceTool.InterfaceTool,
        PloneControlPanel.PloneControlPanel,
        RegistrationTool.RegistrationTool,
        URLTool.URLTool,
        MetadataTool.MetadataTool,
        ActionsTool.ActionsTool,
        TypesTool.TypesTool,
        UndoTool.UndoTool,
        SyndicationTool.SyndicationTool,
        CatalogTool.CatalogTool,
        SkinsTool.SkinsTool,
        DiscussionTool.DiscussionTool,
        ActionIconsTool.ActionIconsTool,
        CalendarTool.CalendarTool,
        QuickInstallerTool.QuickInstallerTool,
        TranslationServiceTool.TranslationServiceTool,
    )

    from Products.CMFCore.utils import ContentInit
    from Products.CMFPlone.utils import ToolInit

    # Register tools and content
    ToolInit(
        'Plone Tool',
        tools=tools,
        icon='tool.gif',
    ).initialize(context)

    ContentInit(
        'Plone Content',
        content_types=contentClasses,
        permission=ADD_CONTENT_PERMISSION,
        extra_constructors=contentConstructors,
    ).initialize(context)

    from Products.CMFPlone.Portal import PloneSite
    from Products.CMFPlone.factory import zmi_constructor
    from AccessControl.Permissions import view_management_screens
    context.registerClass(
        instance_class=PloneSite,
        permission=view_management_screens,
        constructors=(zmi_constructor, ),
    )

    from plone.app.folder import nogopip
    context.registerClass(nogopip.GopipIndex,
                          permission='Add Pluggable Index',
                          constructors=(nogopip.manage_addGopipForm,
                                        nogopip.manage_addGopipIndex),
                          icon='index.gif',
                          visibility=None)
Ejemplo n.º 11
0
            self._read_action_metadata(self.getId(), self.filepath)
            self._read_validator_metadata(self.getId(), self.filepath)
        except:
            log(summary="metadata error", text="file = %s" % self.filepath)
            logException()
            raise

    def _createZODBClone(self):
        """Create a ZODB (editable) equivalent of this object."""
        obj = ControllerPythonScript(self.getId(), filepath=self.filepath)
        obj.write(self.read())
        obj.validators = copy.copy(Acquisition.aq_base(self.validators))  # XXX - don't forget to enable this
        obj.actions = copy.copy(Acquisition.aq_base(self.actions))
        return obj

    security.declarePublic("writableDefaults")

    def writableDefaults(self):
        """Can default actions and validators be modified?"""
        return 0

    def _getState(self):
        return getToolByName(self, "portal_form_controller").getState(self, is_validator=0)


Globals.InitializeClass(FSControllerPythonScript)


registerFileExtension("cpy", FSControllerPythonScript)
registerMetaType("Controller Python Script", FSControllerPythonScript)
Ejemplo n.º 12
0
from Products.CMFCore.FSFile import FSFile
from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore.DirectoryView import registerMetaType
from zope.i18nmessageid import MessageFactory

messageFactory = MessageFactory('medialog.googlefonts')

registerFileExtension('ttf', FSFile)
registerFileExtension('svg', FSFile)
registerFileExtension('woff', FSFile)
registerFileExtension('eot', FSFile)
registerMetaType('File', FSFile)

def initialize(context):
    pass
Ejemplo n.º 13
0
            #posargs = (self, REQUEST, RESPONSE)
            posargs = (self, REQUEST)
        else:
            posargs = ()

        kwargs = {'cooked': self.cook()}
        return template(*posargs, **kwargs)

    security.declareProtected(FTPAccess, 'manage_FTPget')
    def manage_FTPget(self):
        """ Fetch our source for delivery via FTP.
        """
        return self.raw

    security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource')
    def PrincipiaSearchSource(self):
        """ Fetch our source for indexing in a catalog.
        """
        return self.raw

    security.declareProtected(ViewManagementScreens, 'document_src')
    def document_src( self ):
        """ Fetch our source for rendering in the ZMI.
        """
        return self.raw

InitializeClass(FSReSTMethod)

registerFileExtension('rst', FSReSTMethod)
registerMetaType('ReST Method', FSReSTMethod)
Ejemplo n.º 14
0
        self.manage_advanced(max_rows,
                             max_cache,
                             cache_time,
                             '', # don't really see any point in allowing
                             '') # brain specification...

        # do we need to do anything on reparse?


    if Globals.DevelopmentMode:
        # Provide an opportunity to update the properties.
        def __of__(self, parent):
            try:
                self = Acquisition.ImplicitAcquisitionWrapper(self, parent)
                self._updateFromFS()
                return self
            except:
                from zLOG import LOG, ERROR
                import sys
                LOG('FS Z SQL Method',
                    ERROR,
                    'Error during __of__',
                    error=sys.exc_info())
                raise

Globals.InitializeClass(FSZSQLMethod)

registerFileExtension('zsql', FSZSQLMethod)
registerMetaType('Z SQL Method', FSZSQLMethod)
Ejemplo n.º 15
0
        '''
        ks = []
        for key in keys:
            key = str(key).strip()
            if key:
                ks.append(key)
        self._cache_namespace_keys = tuple(ks)
        if REQUEST is not None:
            return self.ZCacheable_manage(self, REQUEST)

    # Zope 2.3.x way:
    def validate(self, inst, parent, name, value, md=None):
        return getSecurityManager().validate(inst, parent, name, value)

    security.declareProtected(FTPAccess, 'manage_FTPget')
    manage_FTPget = DTMLMethod.manage_FTPget.im_func

    security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource')
    PrincipiaSearchSource = DTMLMethod.PrincipiaSearchSource.im_func

    security.declareProtected(ViewManagementScreens, 'document_src')
    document_src = DTMLMethod.document_src.im_func

    security.declareProtected(ViewManagementScreens, 'manage_haveProxy')
    manage_haveProxy = DTMLMethod.manage_haveProxy.im_func

InitializeClass(FSDTMLMethod)

registerFileExtension('dtml', FSDTMLMethod)
registerMetaType('DTML Method', FSDTMLMethod)
Ejemplo n.º 16
0
from Products.CMFPlone.interfaces.siteroot import IPloneSiteRoot

import RhaptosSite

import monkeypatch
import managercatalog  # mostly to test syntax
import security

from setup import RhaptosSitePolicy

this_module = sys.modules[__name__]

# we have an EPS in our skins, and must teach FSDV how to treat it
from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore.FSFile import FSFile
registerFileExtension('eps', FSFile)

from Products.PluggableAuthService import registerMultiPlugin
from Products.PluggableAuthService.permissions import ManageUsers
import pas.AltHashAuth as AHA
from AccessControl import allow_module

registerMultiPlugin(AHA.AltHashAuth.meta_type)

# Make the skins available as DirectoryViews
registerDirectory('skins', globals())


def initialize(context):
    RhaptosSitePolicy.register(context, product_globals)
    RhaptosSite.register(context, product_globals)
Ejemplo n.º 17
0
            security.removeContext(self)

        return result

    # Copy over more methods
    security.declareProtected(FTPAccess, 'manage_FTPget')
    manage_FTPget = ZopePageTemplate.manage_FTPget.im_func

    security.declareProtected(View, 'get_size')
    get_size = ZopePageTemplate.get_size.im_func
    getSize = get_size

    security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource')
    PrincipiaSearchSource = ZopePageTemplate.PrincipiaSearchSource.im_func

    security.declareProtected(ViewManagementScreens, 'document_src')
    document_src = ZopePageTemplate.document_src.im_func

    pt_getContext = ZopePageTemplate.pt_getContext.im_func

    ZScriptHTML_tryParams = ZopePageTemplate.ZScriptHTML_tryParams.im_func

    source_dot_xml = Src()

setattr(PDTPageTemplate, 'source.xml',  PDTPageTemplate.source_dot_xml)
setattr(PDTPageTemplate, 'source.html', PDTPageTemplate.source_dot_xml)
InitializeClass(PDTPageTemplate)

registerFileExtension('pdt', PDTPageTemplate)
registerMetaType('(PDF) Page Template', PDTPageTemplate)
Ejemplo n.º 18
0
                    self.id, err_type, err_msg )
                raise RuntimeError, msg
        else:
            return FSPageTemplate.inheritedAttribute('pt_render')(self,
                source, extra_context )

    # Copy over more mothods
    security.declareProtected(FTPAccess, 'manage_FTPget')
    security.declareProtected(View, 'get_size')
    security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource',
        'document_src')

    _exec = ZopePageTemplate._exec
    pt_getContext = ZopePageTemplate.pt_getContext
    ZScriptHTML_tryParams = ZopePageTemplate.ZScriptHTML_tryParams
    manage_FTPget = ZopePageTemplate.manage_FTPget
    get_size = ZopePageTemplate.get_size
    getSize = get_size
    PrincipiaSearchSource = ZopePageTemplate.PrincipiaSearchSource
    document_src = ZopePageTemplate.document_src


d = FSPageTemplate.__dict__
d['source.xml'] = d['source.html'] = Src()

Globals.InitializeClass(FSPageTemplate)

registerFileExtension('pt', FSPageTemplate)
registerMetaType('Page Template', FSPageTemplate)

Ejemplo n.º 19
0
import os
import sys

from Globals import package_home
from AccessControl import ModuleSecurityInfo
from Products.CMFCore import utils, CMFCorePermissions
from Products.CMFCore.DirectoryView import registerDirectory
from Products.CMFCore.CMFCorePermissions import setDefaultRoles

this_module = sys.modules[ __name__ ]

product_globals = globals()

# Setup XSL transform path
MODULE_XSL =  os.path.join(package_home(globals()), 'www/content_render.xsl')
ModuleSecurityInfo('Products.RhaptosContent').declarePublic('MODULE_XSL')

# Make the skins available as DirectoryViews
registerDirectory('skins', product_globals)

def initialize(context):
    pass

# if we get a custom header fragment from the file system, we must
# turn it into a FSFile, rather than a PageTemplate or some such
from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore.FSFile import FSFile
registerFileExtension('htmlf', FSFile)

Ejemplo n.º 20
0
        finally:
            security.removeContext(self)

        return result

    # Copy over more methods
    security.declareProtected(FTPAccess, 'manage_FTPget')
    manage_FTPget = ZopeSimplate.manage_FTPget

    security.declareProtected(View, 'get_size')
    get_size = ZopeSimplate.get_size
    getSize = get_size

    security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource')
    PrincipiaSearchSource = ZopeSimplate.PrincipiaSearchSource

    security.declareProtected(ViewManagementScreens, 'document_src')
    document_src = ZopeSimplate.document_src

    simplate_getContext = ZopeSimplate.simplate_getContext

    ZScriptHTML_tryParams = ZopeSimplate.ZScriptHTML_tryParams

Globals.InitializeClass(FSSimplate)

registerFileExtension('smpt', FSSimplate)
registerFileExtension('smpl', FSSimplate)
registerFileExtension('spt', FSSimplate)
registerMetaType('Simplate', FSSimplate)
registerIcon(FSSimplate, 'www/fssimplate.png', globals())
Ejemplo n.º 21
0
def initialize(context):

    # Stuff has been moved from module level to this method for a
    # better separation of import and installation.
    # For the general user this change does not make a difference.
    # For test authors (and people who use parts of Plone only)
    # it does speed up import *significantly*.

    from AccessControl import ModuleSecurityInfo
    from AccessControl import allow_module, allow_class

    # allow logging
    ModuleSecurityInfo('logging').declarePublic('getLogger')
    from logging import Logger
    allow_class(Logger)

    # Register kss extension to allow it used from fs skins
    from Products.CMFCore.DirectoryView import registerFileExtension
    from Products.CMFCore.FSFile import FSFile
    registerFileExtension('kss', FSFile)

    # various small utils functions
    # added for unescaping view names in urls when finding selected action
    ModuleSecurityInfo('urllib').declarePublic('unquote')

    allow_module('Products.CMFPlone.utils')

    # For content_status_modify
    from Products.CMFCore.WorkflowCore import ObjectMoved, ObjectDeleted, \
                                              WorkflowException
    ModuleSecurityInfo('Products.CMFCore.WorkflowCore').declarePublic('ObjectMoved')
    ModuleSecurityInfo('Products.CMFCore.WorkflowCore').declarePublic('ObjectDeleted')
    ModuleSecurityInfo('Products.CMFCore.WorkflowCore').declarePublic('WorkflowException')
    allow_class(ObjectMoved)
    allow_class(ObjectDeleted)
    allow_class(WorkflowException)

    from PloneBatch import Batch
    allow_class(Batch)

    # Make Batch available at module level
    this_module.Batch = Batch

    from StringIO import StringIO
    allow_class(StringIO)

    # Make Unauthorized importable TTW
    ModuleSecurityInfo('AccessControl').declarePublic('Unauthorized')

    # Make Forbidden importable TTW
    ModuleSecurityInfo('zExceptions').declarePublic('Forbidden')

    # Make ConflictError importable TTW
    ModuleSecurityInfo('ZODB.POSException').declarePublic('ConflictError')

    # Make ZCTextIndex ParseError importable TTW
    ModuleSecurityInfo('Products.ZCTextIndex.ParseTree').declarePublic('ParseError')

    # Make DateTimeError importable TTW
    ModuleSecurityInfo('DateTime.interfaces').declarePublic('DateTimeError')
    ModuleSecurityInfo('DateTime.interfaces').declarePublic('SyntaxError')

    # BBB support for DateTime < 3
    ModuleSecurityInfo('DateTime.DateTime').declarePublic('DateTimeError')
    ModuleSecurityInfo('DateTime.DateTime').declarePublic('SyntaxError')

    # Make CopyError importable TTW
    ModuleSecurityInfo('OFS.CopySupport').declarePublic('CopyError')

    # Make DiscussionNotAllowed importable TTW
    ModuleSecurityInfo('Products.CMFDefault.DiscussionTool').declarePublic('DiscussionNotAllowed')

    # Make AllowSendto importable TTW
    ModuleSecurityInfo('Products.CMFPlone.PloneTool').declarePublic('AllowSendto')

    # Make ZCatalog's mergeResults importable TTW
    ModuleSecurityInfo('Products.ZCatalog.Catalog').declarePublic('mergeResults')

    # Make the navtree constructs available TTW
    allow_module('Products.CMFPlone.browser.navtree')

    # Allow access to the exception in the folder_delete script
    from OFS.ObjectManager import BeforeDeleteException
    allow_module('OFS.ObjectManager')
    allow_class(BeforeDeleteException)

    # Make cgi.escape available TTW
    ModuleSecurityInfo('cgi').declarePublic('escape')

    # Apply monkey patches
    import patches

    # Register unicode splitter w/ ZCTextIndex
    # pipeline registry
    import UnicodeSplitter

    # Plone content

    # Usage of PloneFolder is discouraged.
    import PloneFolder

    contentClasses = (PloneFolder.PloneFolder, )
    contentConstructors = (PloneFolder.addPloneFolder, )

    # CMFCore and CMFDefault tools
    from Products.CMFCore import CachingPolicyManager

    # Plone tools
    import PloneTool
    import FactoryTool
    import InterfaceTool
    import MigrationTool
    import PloneControlPanel
    import WorkflowTool
    import URLTool
    import MetadataTool
    import RegistrationTool
    import SyndicationTool
    import PropertiesTool
    import ActionsTool
    import TypesTool
    import UndoTool
    import CatalogTool
    import SkinsTool
    import DiscussionTool
    import CalendarTool
    import ActionIconsTool
    import QuickInstallerTool
    import TranslationServiceTool

    tools = (PloneTool.PloneTool,
             WorkflowTool.WorkflowTool,
             CachingPolicyManager.CachingPolicyManager,
             FactoryTool.FactoryTool,
             PropertiesTool.PropertiesTool,
             MigrationTool.MigrationTool,
             InterfaceTool.InterfaceTool,
             PloneControlPanel.PloneControlPanel,
             RegistrationTool.RegistrationTool,
             URLTool.URLTool,
             MetadataTool.MetadataTool,
             ActionsTool.ActionsTool,
             TypesTool.TypesTool,
             UndoTool.UndoTool,
             SyndicationTool.SyndicationTool,
             CatalogTool.CatalogTool,
             SkinsTool.SkinsTool,
             DiscussionTool.DiscussionTool,
             ActionIconsTool.ActionIconsTool,
             CalendarTool.CalendarTool,
             QuickInstallerTool.QuickInstallerTool,
             TranslationServiceTool.TranslationServiceTool,
            )

    from Products.CMFCore.utils import ContentInit
    from Products.CMFPlone.utils import ToolInit

    # Register tools and content
    ToolInit('Plone Tool',
             tools=tools,
             icon='tool.gif',
             ).initialize(context)

    ContentInit('Plone Content',
                content_types=contentClasses,
                permission=ADD_CONTENT_PERMISSION,
                extra_constructors=contentConstructors,
                ).initialize(context)

    from Products.CMFPlone.Portal import PloneSite
    from Products.CMFPlone.factory import zmi_constructor
    from AccessControl.Permissions import view_management_screens
    context.registerClass(
        instance_class=PloneSite,
        permission=view_management_screens,
        constructors=(zmi_constructor, ),
    )

    from plone.app.folder import nogopip
    context.registerClass(nogopip.GopipIndex,
        permission = 'Add Pluggable Index',
        constructors = (nogopip.manage_addGopipForm,
                        nogopip.manage_addGopipIndex),
        icon = 'index.gif',
        visibility = None)
Ejemplo n.º 22
0
import sys

from Globals import package_home
from AccessControl import ModuleSecurityInfo
from Products.CMFCore import utils, CMFCorePermissions
from Products.CMFCore.DirectoryView import registerDirectory
from Products.CMFCore.CMFCorePermissions import setDefaultRoles

this_module = sys.modules[__name__]

product_globals = globals()

# Setup XSL transform path
MODULE_XSL = os.path.join(package_home(globals()), 'www/content_render.xsl')
ModuleSecurityInfo('Products.RhaptosContent').declarePublic('MODULE_XSL')

# Make the skins available as DirectoryViews
registerDirectory('skins', product_globals)


def initialize(context):
    pass


# if we get a custom header fragment from the file system, we must
# turn it into a FSFile, rather than a PageTemplate or some such
from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore.FSFile import FSFile

registerFileExtension('htmlf', FSFile)
Ejemplo n.º 23
0
# test for FileSystemSite
try:
    import Products.FileSystemSite
    have_fss = 1
except ImportError:
    have_fss = 0

# do the minimal stuff for skin registering
# note that CMF/Plone users will still have to run the
# Extensions/Install.py script
if have_cmf:
    # Need to do this in case Archetypes isn't present.
    from Products.CMFCore.FSFile import FSFile
    from Products.CMFCore.DirectoryView import registerFileExtension, registerDirectory
    registerFileExtension('xsl', FSFile)
    registerDirectory('common', globals())

    if have_plone:
        from Products.kupu.plone import initialize

elif have_zope2 and have_fss:
    import zope2
    initialize = zope2.initialize

if have_zope2:
    # in Zope 2, make all modules in the 'python' lib available
    def __allow_access_to_unprotected_subobjects__(name, value=None):
        return name in ('python')

    from AccessControl import allow_module
Ejemplo n.º 24
0
Archivo: FSForm.py Proyecto: poses/erp5
    def __init__(self, id, filepath, fullname=None, properties=None):
        FSObject.__init__(self, id, filepath, fullname, properties)

    def _createZODBClone(self):
        """Create a ZODB (editable) equivalent of this object."""
        obj = ERP5Form(self.getId(), self.title)
        obj.set_xml(self.get_xml())
        return obj

    def _readFile(self, reparse):
        f = open(expandpath(self._filepath), 'rb')
        # update the form with the xml data
        try:
            XMLToForm(f.read(), self)
        except:
            # bare except here, but I hope this is ok, as the
            # exception should be reraised
            # (except if the LOG raises another one ... should we be more paranoid here?)
            import zLOG
            zLOG.LOG('Formulator.FSForm',zLOG.ERROR,
                     'error reading form from file '+expandpath(self._filepath))
            raise

        f.close()

Globals.InitializeClass(ERP5FSForm)

registerFileExtension('form', ERP5FSForm)
registerMetaType('FSForm', ERP5FSForm)
Ejemplo n.º 25
0
    title = ComputedAttribute(title, 1)

    def getBindingAssignments(self):
        # Override of the version in Bindings.py.
        # This version ensures that bindings get loaded on demand.
        if not hasattr(self, '_bind_names'):
            # Set a default first to avoid recursion
            self._setupBindings()
            # Now do it for real
            self._updateFromFS()
        return self._bind_names


InitializeClass(FSPythonScript)


class FSPythonScriptTracebackSupplement:
    """Implementation of ITracebackSupplement

    Makes script-specific info available in exception tracebacks.
    """
    def __init__(self, script, line=-1):
        self.object = script
        # If line is set to -1, it means to use tb_lineno.
        self.line = line


registerFileExtension('py', FSPythonScript)
registerMetaType('Script (Python)', FSPythonScript)
Ejemplo n.º 26
0
        icons = icons + ({'path': 'misc_/PageTemplates/exclamation.gif',
                          'alt': 'Error',
                          'title': 'This template has an error'},)
    return icons

  def _getFileName(self):
    """Returns the filename used for content-disposition header.
    """
    # The "filename" property has a TALES type, but getProperty for TALES types
    # only works if the context has an ERP5 Site in his acquisition context.
    # If it's not the case, we will not evaluate the TALES, but simply use the
    # template's title or id as filename.
    if getattr(self, 'getPortalObject', None) is None:
      return self.title_or_id()
    return self.getProperty('filename')

InitializeClass(OOoTemplate)

class FSOOoTemplate(FSPageTemplate, OOoTemplate):

  meta_type = "ERP5 Filesystem OOo Template"
  icon = "www/OOo.png"

  def __call__(self, *args, **kwargs):
    return OOoTemplate.__call__(self, *args, **kwargs)

InitializeClass(FSOOoTemplate)

registerFileExtension('ooot', FSOOoTemplate)
registerMetaType(OOoTemplate.meta_type, FSOOoTemplate)
Ejemplo n.º 27
0
        self.manage_advanced(
            max_rows,
            max_cache,
            cache_time,
            '',  # don't really see any point in allowing
            '')  # brain specification...

        # do we need to do anything on reparse?

    if Globals.DevelopmentMode:
        # Provide an opportunity to update the properties.
        def __of__(self, parent):
            try:
                self = Acquisition.ImplicitAcquisitionWrapper(self, parent)
                self._updateFromFS()
                return self
            except:
                from zLOG import LOG, ERROR
                import sys
                LOG('FS Z SQL Method',
                    ERROR,
                    'Error during __of__',
                    error=sys.exc_info())
                raise


Globals.InitializeClass(FSZSQLMethod)

registerFileExtension('zsql', FSZSQLMethod)
registerMetaType('Z SQL Method', FSZSQLMethod)
Ejemplo n.º 28
0
        return icons

    def _getFileName(self):
        """Returns the filename used for content-disposition header.
    """
        # The "filename" property has a TALES type, but getProperty for TALES types
        # only works if the context has an ERP5 Site in his acquisition context.
        # If it's not the case, we will not evaluate the TALES, but simply use the
        # template's title or id as filename.
        if getattr(self, 'getPortalObject', None) is None:
            return self.title_or_id()
        return self.getProperty('filename')


InitializeClass(OOoTemplate)


class FSOOoTemplate(FSPageTemplate, OOoTemplate):

    meta_type = "ERP5 Filesystem OOo Template"
    icon = "www/OOo.png"

    def __call__(self, *args, **kwargs):
        return OOoTemplate.__call__(self, *args, **kwargs)


InitializeClass(FSOOoTemplate)

registerFileExtension('ooot', FSOOoTemplate)
registerMetaType(OOoTemplate.meta_type, FSOOoTemplate)
Ejemplo n.º 29
0
            f.write(result)
            f.seek(0)
            result=RDB.File(f,brain,p, zc)
        else:
            result=Results(result, brain, p, zc)
        columns=result._searchable_result_columns()
        if test__ and columns != self._col: self._col=columns

        # If run in test mode, return both the query and results so
        # that the template doesn't have to be rendered twice!
        if test__: return query, result

        return result


    if Globals.DevelopmentMode:
        # Provide an opportunity to update the properties.
        def __of__(self, parent):
            try:
                self = ImplicitAcquisitionWrapper(self, parent)
                self._updateFromFS()
                return self
            except:
                logger.exception("Error during __of__")
                raise

Globals.InitializeClass(FSORAMethod)

registerFileExtension('zora', FSORAMethod)
registerMetaType('Oracle Method', FSORAMethod)
Ejemplo n.º 30
0
    def manage_afterAdd(self, object, container):
        try:
            BaseClass.manage_afterAdd(self, object, container)
        except:
            logException()
            raise

    def _createZODBClone(self):
        """Create a ZODB (editable) equivalent of this object."""
        obj = ControllerValidator(self.getId())
        obj.write(self.read())
        return obj

    security.declarePublic('writableDefaults')

    def writableDefaults(self):
        """Can default actions and validators be modified?"""
        return 0

    def _getState(self):
        return getToolByName(self,
                             'portal_form_controller').getState(self,
                                                                is_validator=1)


InitializeClass(FSControllerValidator)

registerFileExtension('vpy', FSControllerValidator)
registerMetaType('Controller Validator', FSControllerValidator)
Ejemplo n.º 31
0
    def pt_render(self, source=0, extra_context={}):
        # Tie in on an opportunity to auto-reload
        self._updateFromFS()
        return FSPageTemplate.inheritedAttribute('pt_render')(self, source,
                                                              extra_context)

    # Copy over more mothods
    security.declareProtected(FTPAccess, 'manage_FTPget')
    security.declareProtected(View, 'get_size')
    security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource',
                              'document_src')

    _exec = ZopePageTemplate._exec
    pt_getContext = ZopePageTemplate.pt_getContext
    ZScriptHTML_tryParams = ZopePageTemplate.ZScriptHTML_tryParams
    manage_FTPget = ZopePageTemplate.manage_FTPget
    get_size = ZopePageTemplate.get_size
    getSize = get_size
    PrincipiaSearchSource = ZopePageTemplate.PrincipiaSearchSource
    document_src = ZopePageTemplate.document_src


d = FSPageTemplate.__dict__
d['source.xml'] = d['source.html'] = Src()

Globals.InitializeClass(FSPageTemplate)

registerFileExtension('pt', FSPageTemplate)
registerMetaType('Page Template', FSPageTemplate)
Ejemplo n.º 32
0
    def _setOldCacheHeaders(self):
        # return False to disable this simple caching behaviour
        return _FSCacheHeaders(self)

    security.declareProtected(View, 'getContentType')

    def getContentType(self):
        """Get the content type of a file or image.

        Returns the content type (MIME type) of a file or image.
        """
        self._updateFromFS()
        return self.content_type

    security.declareProtected(FTPAccess, 'manage_FTPget')
    manage_FTPget = index_html


InitializeClass(FSFile)

registerFileExtension('doc', FSFile)
registerFileExtension('txt', FSFile)
registerFileExtension('pdf', FSFile)
registerFileExtension('swf', FSFile)
registerFileExtension('jar', FSFile)
registerFileExtension('cab', FSFile)
registerFileExtension('ico', FSFile)
registerFileExtension('js', FSFile)
registerFileExtension('css', FSFile)
registerMetaType('File', FSFile)
Ejemplo n.º 33
0
# -*- extra stuff goes here -*-


def initialize(context):
    """Initializer called when used as a Zope 2 product."""

from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore.FSFile import FSFile

registerFileExtension('svg', FSFile)
registerFileExtension('ttf', FSFile)
registerFileExtension('less', FSFile)
registerFileExtension('woff', FSFile)
registerFileExtension('svg', FSFile)


from fanstatic import Library, Resource

theme_library = Library('theme', 'theme_resources')
body = Resource(theme_library, 'body.css')
Ejemplo n.º 34
0
from Products.zms import ZMSZCatalogAdapter
from Products.zms import ZMSFilterManager
from Products.zms import ZMSFormatProvider, ZMSFormatProviderAcquired
from Products.zms import ZMSMetacmdProvider, ZMSMetacmdProviderAcquired
from Products.zms import ZMSWorkflowProvider, ZMSWorkflowProviderAcquired
from Products.zms import ZMSRepositoryManager
"""ZMS Product"""
# Documentation string.
__doc__ = """initialization module."""
# Version string.
__version__ = '0.1'

try:
    from Products.CMFCore.DirectoryView import registerFileExtension
    from Products.CMFCore.FSFile import FSFile
    registerFileExtension('xlsx', FSFile)
    registerFileExtension('xls', FSFile)
    registerFileExtension('doc', FSFile)
    registerFileExtension('docx', FSFile)
    registerFileExtension('ppt', FSFile)
    registerFileExtension('pptx', FSFile)
    registerFileExtension('map', FSFile)
    registerFileExtension('svg', FSFile)
    registerFileExtension('ttf', FSFile)
    registerFileExtension('eot', FSFile)
    registerFileExtension('woff', FSFile)
    registerFileExtension('woff2', FSFile)
    registerFileExtension('mp3', FSFile)
    registerFileExtension('mp4', FSFile)
    registerFileExtension('json', FSFile)
except:
Ejemplo n.º 35
0
InitializeClass(PDFTemplate)


class FSPDFTemplate(FSPageTemplate, PDFTemplate):

    meta_type = "ERP5 Filesystem PDF Template"
    icon = "www/PDF.png"

    def __call__(self, *args, **kwargs):
        return PDFTemplate.__call__(self, *args, **kwargs)


InitializeClass(FSPDFTemplate)

registerFileExtension('pdft', FSPDFTemplate)
registerMetaType('ERP5 PDF Template', FSPDFTemplate)

# Dynamic Patch
try:
    from Products.CMFReportTool.ReportTool import ReportTool
except ImportError:
    ReportTool = None

if ReportTool:
    try:
        from Products.CMFReportTool.ReportTool import ZODBResourceHandler
        HAS_ZODB_RESOURCE_HANDLER = 1
    except ImportError:
        from Products.CMFReportTool.ReportTool import ZODBHandler, ResourceHandler
        HAS_ZODB_RESOURCE_HANDLER = 0
Ejemplo n.º 36
0
import RhaptosSite

import monkeypatch
import managercatalog  # mostly to test syntax
import security

from setup import RhaptosSitePolicy

this_module = sys.modules[ __name__ ]


# we have an EPS in our skins, and must teach FSDV how to treat it
from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore.FSFile import FSFile
registerFileExtension('eps', FSFile)

from Products.PluggableAuthService import registerMultiPlugin
from Products.PluggableAuthService.permissions import ManageUsers
import pas.AltHashAuth as AHA
from AccessControl import allow_module

registerMultiPlugin(AHA.AltHashAuth.meta_type)

# Make the skins available as DirectoryViews
registerDirectory('skins', globals())

def initialize(context):
    RhaptosSitePolicy.register(context, product_globals)
    RhaptosSite.register(context, product_globals)
    
Ejemplo n.º 37
0
            posargs = (self, REQUEST)
        else:
            posargs = ()

        kwargs = {'cooked': self.cook()}
        return template(*posargs, **kwargs)

    @security.protected(FTPAccess)
    def manage_FTPget(self):
        """ Fetch our source for delivery via FTP.
        """
        return self.raw

    @security.protected(ViewManagementScreens)
    def PrincipiaSearchSource(self):
        """ Fetch our source for indexing in a catalog.
        """
        return self.raw

    @security.protected(ViewManagementScreens)
    def document_src(self):
        """ Fetch our source for rendering in the ZMI.
        """
        return self.raw


InitializeClass(FSSTXMethod)

registerFileExtension('stx', FSSTXMethod)
registerMetaType('STX Method', FSSTXMethod)
Ejemplo n.º 38
0
            self._read_action_metadata(self.getId(), self.filepath)
            self._read_validator_metadata(self.getId(), self.filepath)
        except:
            log(summary='metadata error', text='file = %s' % self.filepath)
            logException()
            raise

    def _createZODBClone(self):
        """Create a ZODB (editable) equivalent of this object."""
        obj = ControllerPythonScript(self.getId(), filepath=self.filepath)
        obj.write(self.read())
        obj.validators = copy.copy(Acquisition.aq_base(self.validators))  # XXX - don't forget to enable this
        obj.actions = copy.copy(Acquisition.aq_base(self.actions))
        return obj


    security.declarePublic('writableDefaults')
    def writableDefaults(self):
        """Can default actions and validators be modified?"""
        return 0

    def _getState(self):
        return getToolByName(self, 'portal_form_controller').getState(self, is_validator=0)


InitializeClass(FSControllerPythonScript)


registerFileExtension('cpy', FSControllerPythonScript)
registerMetaType('Controller Python Script', FSControllerPythonScript)
Ejemplo n.º 39
0
                proptype, propvstr = proptv.split( '=', 1 )
                propname = propname.strip()
                proptype = proptype.strip()
                propvstr = propvstr.strip()
                converter = get_converter( proptype, lambda x: x )
                propvalue = converter( propvstr )
                # Should be safe since we're loading from
                # the filesystem.
                setattr(self, propname, propvalue)
                map.append({'id':propname,
                            'type':proptype,
                            'mode':'',
                            'default_value':propvalue,
                            })
            except:
                raise ValueError, ( 'Error processing line %s of %s:\n%s'
                                  % (lino,self._filepath,line) )
        self._properties = tuple(map)

    if Globals.DevelopmentMode:
        # Provide an opportunity to update the properties.
        def __of__(self, parent):
            self = ImplicitAcquisitionWrapper(self, parent)
            self._updateFromFS()
            return self

InitializeClass(FSPropertiesObject)

registerFileExtension('props', FSPropertiesObject)
registerMetaType('Properties Object', FSPropertiesObject)
Ejemplo n.º 40
0
    title = ComputedAttribute(title, 1)

    def getBindingAssignments(self):
        # Override of the version in Bindings.py.
        # This version ensures that bindings get loaded on demand.
        if not hasattr(self, '_bind_names'):
            # Set a default first to avoid recursion
            self._setupBindings()
            # Now do it for real
            self._updateFromFS()
        return self._bind_names

InitializeClass(FSPythonScript)


class FSPythonScriptTracebackSupplement:

    """Implementation of ITracebackSupplement

    Makes script-specific info available in exception tracebacks.
    """

    def __init__(self, script, line=-1):
        self.object = script
        # If line is set to -1, it means to use tb_lineno.
        self.line = line


registerFileExtension('py', FSPythonScript)
registerMetaType('Script (Python)', FSPythonScript)
Ejemplo n.º 41
0
        cache_time = parameters.get("cache_time", 0)
        class_name = parameters.get("class_name", "")
        class_file = parameters.get("class_file", "")
        connection_hook = parameters.get("connection_hook", None)
        direct = parameters.get("allow_simple_one_argument_traversal", None)

        self.manage_edit(title, connection_id, arguments, template=data)

        self.manage_advanced(
            max_rows, max_cache, cache_time, class_name, class_file, connection_hook=connection_hook, direct=direct
        )

        # do we need to do anything on reparse?

    if Globals.DevelopmentMode:
        # Provide an opportunity to update the properties.
        def __of__(self, parent):
            try:
                self = ImplicitAcquisitionWrapper(self, parent)
                self._updateFromFS()
                return self
            except:
                logger.exception("Error during __of__")
                raise


InitializeClass(FSZSQLMethod)

registerFileExtension("zsql", FSZSQLMethod)
registerMetaType("Z SQL Method", FSZSQLMethod)
            **kwargs)

    def _createZODBClone(self):
        """Create a ZODB (editable) equivalent of this object."""
        obj = ControllerPageTemplate(self.getId(), self._text,
                                     self.content_type)
        obj.expand = 0
        obj.write(self.read())
        obj.validators = copy.copy(Acquisition.aq_base(self.validators))
        obj.actions = copy.copy(Acquisition.aq_base(self.actions))
        return obj

    security.declarePublic('writableDefaults')

    def writableDefaults(self):
        """Can default actions and validators be modified?"""
        return 0


_s = Src()

setattr(FSControllerPageTemplate, 'source.xml', _s)
setattr(FSControllerPageTemplate, 'source.html', _s)

del _s

InitializeClass(FSControllerPageTemplate)

registerFileExtension('cpt', FSControllerPageTemplate)
registerMetaType('Controller Page Template', FSControllerPageTemplate)
Ejemplo n.º 43
0
        return self.getModTime()

    security.declareProtected(View, 'getContentType')
    def getContentType(self):
        """Get the content type of a file or image.

        Returns the content type (MIME type) of a file or image.
        """
        self._updateFromFS()
        return self.content_type

    security.declareProtected(View, 'get_size')
    def get_size(self):
        """
            Return the size of the image.
        """
        self._updateFromFS()
        return self._data and len(self._data) or 0

    security.declareProtected(FTPAccess, 'manage_FTPget')
    manage_FTPget = index_html

InitializeClass(FSImage)

registerFileExtension('gif', FSImage)
registerFileExtension('jpg', FSImage)
registerFileExtension('jpeg', FSImage)
registerFileExtension('png', FSImage)
registerFileExtension('bmp', FSImage)
registerMetaType('Image', FSImage)
Ejemplo n.º 44
0
            keyset = {
                      # Why oh why?
                      # All this code is cut and paste
                      # here to make sure that we
                      # dont call _getContext and hence can't cache
                      # Annoying huh?
                      'here': self.aq_parent.getPhysicalPath(),
                      'bound_names': bound_names}
            result = self.ZCacheable_get(keywords=keyset)
            if result is not None:
                # Got a cached value.
                return result

        # Execute the template in a new security context.
        security.addContext(self)
        try:
            result = self.pt_render(extra_context=bound_names)
            if keyset is not None:
                # Store the result in the cache.
                self.ZCacheable_set(result, keywords=keyset)
            return result
        finally:
            security.removeContext(self)

        return result

InitializeClass(FSMailTemplate)

registerFileExtension('mt', FSMailTemplate)
registerMetaType('Mail Template', FSMailTemplate)
Ejemplo n.º 45
0
# test for FileSystemSite
try:
    import Products.FileSystemSite
    have_fss = 1
except ImportError:
    have_fss = 0

# do the minimal stuff for skin registering
# note that CMF/Plone users will still have to run the
# Extensions/Install.py script
if have_cmf:
    # Need to do this in case Archetypes isn't present.
    from Products.CMFCore.FSFile import FSFile
    from Products.CMFCore.DirectoryView import registerFileExtension, registerDirectory
    registerFileExtension('xsl', FSFile)
    registerDirectory('common', globals())

    if have_plone:
        from Products.kupu.plone import initialize

elif have_zope2 and have_fss:
    import zope2
    initialize = zope2.initialize

if have_zope2:
    # in Zope 2, make all modules in the 'python' lib available
    def __allow_access_to_unprotected_subobjects__(name, value=None):
        return name in ('python')

    from AccessControl import allow_module
Ejemplo n.º 46
0
    # Copy over more methods
    security.declareProtected(FTPAccess, 'manage_FTPget')
    manage_FTPget = ZopePageTemplate.manage_FTPget.im_func

    security.declareProtected(View, 'get_size')
    get_size = ZopePageTemplate.get_size.im_func
    getSize = get_size

    security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource')
    PrincipiaSearchSource = ZopePageTemplate.PrincipiaSearchSource.im_func

    security.declareProtected(ViewManagementScreens, 'document_src')
    document_src = ZopePageTemplate.document_src.im_func

    pt_getContext = ZopePageTemplate.pt_getContext.im_func

    ZScriptHTML_tryParams = ZopePageTemplate.ZScriptHTML_tryParams.im_func

    source_dot_xml = Src()

setattr(FSPageTemplate, 'source.xml', FSPageTemplate.source_dot_xml)
setattr(FSPageTemplate, 'source.html', FSPageTemplate.source_dot_xml)
InitializeClass(FSPageTemplate)

registerFileExtension('pt', FSPageTemplate)
registerFileExtension('zpt', FSPageTemplate)
registerFileExtension('html', FSPageTemplate)
registerFileExtension('htm', FSPageTemplate)
registerMetaType('Page Template', FSPageTemplate)
Ejemplo n.º 47
0
                propname = propname.strip()
                proptype = proptype.strip()
                propvstr = propvstr.strip()
                converter = get_converter(proptype, lambda x: x)
                propvalue = converter(propvstr)
                # Should be safe since we're loading from
                # the filesystem.
                setattr(self, propname, propvalue)
                map.append({'id': propname,
                            'type': proptype,
                            'mode': '',
                            'default_value': propvalue,
                            })
            except Exception:
                raise ValueError('Error processing line %s of %s:\n%s'
                                 % (lino, self._filepath, line))
        self._properties = tuple(map)

    if getConfiguration().debug_mode:
        # Provide an opportunity to update the properties.
        def __of__(self, parent):
            self = ImplicitAcquisitionWrapper(self, parent)
            self._updateFromFS()
            return self


InitializeClass(FSPropertiesObject)

registerFileExtension('props', FSPropertiesObject)
registerMetaType('Properties Object', FSPropertiesObject)
Ejemplo n.º 48
0
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
    __import__('pkg_resources').declare_namespace(__name__)
except ImportError:
    from pkgutil import extend_path
    __path__ = extend_path(__path__, __name__)


from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore.FSFile import FSFile

registerFileExtension('mid', FSFile)
registerFileExtension('mp3', FSFile)
registerFileExtension('swf', FSFile)
registerFileExtension('js', FSFile)
Ejemplo n.º 49
0
        return icons


InitializeClass(PDFTemplate)

class FSPDFTemplate(FSPageTemplate, PDFTemplate):

    meta_type = "ERP5 Filesystem PDF Template"
    icon = "www/PDF.png"

    def __call__(self, *args, **kwargs):
      return PDFTemplate.__call__(self, *args, **kwargs)

InitializeClass(FSPDFTemplate)

registerFileExtension('pdft', FSPDFTemplate)
registerMetaType('ERP5 PDF Template', FSPDFTemplate)

# Dynamic Patch
try:
  from Products.CMFReportTool.ReportTool import ReportTool
except ImportError:
  ReportTool = None


if ReportTool:
  try:
    from Products.CMFReportTool.ReportTool import ZODBResourceHandler
    HAS_ZODB_RESOURCE_HANDLER=1
  except ImportError:
    from Products.CMFReportTool.ReportTool import ZODBHandler, ResourceHandler
Ejemplo n.º 50
0
from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore.FSFile import FSFile

registerFileExtension("zip", FSFile)
registerFileExtension("txt", FSFile)

    security.declarePrivate('manage_afterAdd')
    def manage_afterAdd(self, object, container):
        try:
            BaseClass.manage_afterAdd(self, object, container)
        except:
            logException()
            raise


    def _createZODBClone(self):
        """Create a ZODB (editable) equivalent of this object."""
        obj = ControllerValidator(self.getId())
        obj.write(self.read())
        return obj


    security.declarePublic('writableDefaults')
    def writableDefaults(self):
        """Can default actions and validators be modified?"""
        return 0

    def _getState(self):
        return getToolByName(self, 'portal_form_controller').getState(self, is_validator=1)

InitializeClass(FSControllerValidator)

registerFileExtension('vpy', FSControllerValidator)
registerMetaType('Controller Validator', FSControllerValidator)
Ejemplo n.º 52
0
from . import zmslinkelement
from . import _confmanager
from . import _multilangmanager
from . import _mediadb
from . import _sequence
from . import _zmsattributecontainer
from . import ZMSZCatalogAdapter
from . import ZMSFormatProvider, ZMSFormatProviderAcquired
from . import ZMSMetacmdProvider, ZMSMetacmdProviderAcquired
from . import ZMSWorkflowProvider, ZMSWorkflowProviderAcquired
from . import ZMSRepositoryManager

try:
    from Products.CMFCore.DirectoryView import registerFileExtension
    from Products.CMFCore.FSFile import FSFile
    registerFileExtension('map', FSFile)
    registerFileExtension('svg', FSFile)
    registerFileExtension('ttf', FSFile)
    registerFileExtension('eot', FSFile)
    registerFileExtension('woff', FSFile)
    registerFileExtension('woff2', FSFile)
except:
    pass

################################################################################
# Define the initialize() function.
################################################################################


def initialize(context):
    """Initialize the product."""