Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def do_aliases():
sys.modules['opencore.siteui'] = opencore.browser
#sys.modules['opencore.nui'] = opencore.browser
sys.modules['opencore.nui.project'] = opencore.project.browser
sys.modules['opencore.nui.member'] = opencore.member.browser
sys.modules['opencore.nui.member.transient_messages'] = opencore.bbb.transient_messages
sys.modules['opencore.nui.member.interfaces'] = opencore.interfaces.bbb
sys.modules['opencore.nui.project.interfaces'] = opencore.interfaces.bbb
sys.modules['opencore.siteui.interfaces'] = opencore.interfaces.member
# wicked BBB crap
sys.modules['Products.wicked'] = wicked
sys.modules['Products.wicked.lib'] = wicked
sys.modules['Products.wicked.lib.cache'] = wicked.cache # for CacheStore obs
sys.modules['Products.wicked.interfaces'] = wicked.interfaces
sys.modules['Products.wicked.example'] = wicked.atcontent
sys.modules['Products.wicked.example.wickeddoc'] = wicked.atcontent.wickeddoc
# RichDocument -> SimpleAttachment
sys.modules['Products.RichDocument.content.attachments'] = \
Products.SimpleAttachment.content.file
sys.modules['opencore.siteui'] = opencore.browser
#sys.modules['opencore.nui'] = opencore.browser
sys.modules['opencore.nui.project'] = opencore.project.browser
sys.modules['opencore.nui.member'] = opencore.member.browser
sys.modules['opencore.nui.member.transient_messages'] = opencore.bbb.transient_messages
sys.modules['opencore.nui.member.interfaces'] = opencore.interfaces.bbb
sys.modules['opencore.nui.project.interfaces'] = opencore.interfaces.bbb
sys.modules['opencore.siteui.interfaces'] = opencore.interfaces.member
# wicked BBB crap
sys.modules['Products.wicked'] = wicked
sys.modules['Products.wicked.lib'] = wicked
sys.modules['Products.wicked.lib.cache'] = wicked.cache # for CacheStore obs
sys.modules['Products.wicked.interfaces'] = wicked.interfaces
sys.modules['Products.wicked.example'] = wicked.atcontent
sys.modules['Products.wicked.example.wickeddoc'] = wicked.atcontent.wickeddoc
# RichDocument -> SimpleAttachment
sys.modules['Products.RichDocument.content.attachments'] = \
Products.SimpleAttachment.content.file
"""
Implementation of an OpenPlans-specific page type, based on
RichDocument w/ interface changes and wicked support.
"""
from Products.Archetypes.public import registerType
from Products.Archetypes.public import Schema
from Products.Archetypes.public import BooleanField
from Products.RichDocument.content.richdocument import RichDocument
from Products.RichDocument.widgets.attachments import AttachmentsManagerWidget
from wicked.atcontent.wickeddoc import WickedDoc
from opencore.interfaces import IOpenPage
from opencore.configuration import PROJECTNAME
from zope.interface import implements
schema = WickedDoc.schema.copy()
hidden_fields = ('relatedItems', 'allowDiscussion')
for fld in hidden_fields:
schema[fld].widget.visible={'edit': 'invisible',
'view': 'invisible',
}
schema['text'].scope = 'getContainerPath'
schema['text'].widget.macro = "binsmart_rich"
schema['text'].widget.helper_js = ("toggle_editor.js",)
schema['text'].allowable_content_types = ('text/html',)
schema['text'].default_output_type = 'text/html'
schema['description'].widget.rows = 1
# Prevent bug 1689 from occurring with pages too.
def do_aliases():
sys.modules['opencore.siteui'] = opencore.browser
#sys.modules['opencore.nui'] = opencore.browser
sys.modules['opencore.nui.project'] = opencore.project.browser
sys.modules['opencore.nui.member'] = opencore.member.browser
sys.modules['opencore.nui.member.transient_messages'] = opencore.bbb.transient_messages
sys.modules['opencore.nui.member.interfaces'] = opencore.interfaces.bbb
sys.modules['opencore.nui.project.interfaces'] = opencore.interfaces.bbb
sys.modules['opencore.siteui.interfaces'] = opencore.interfaces.member
# wicked BBB crap
sys.modules['Products.wicked'] = wicked
sys.modules['Products.wicked.lib'] = wicked
sys.modules['Products.wicked.lib.cache'] = wicked.cache # for CacheStore obs
sys.modules['Products.wicked.interfaces'] = wicked.interfaces
sys.modules['Products.wicked.example'] = wicked.atcontent
sys.modules['Products.wicked.example.wickeddoc'] = wicked.atcontent.wickeddoc
# RichDocument -> SimpleAttachment
sys.modules['Products.RichDocument.content.attachments'] = \
Products.SimpleAttachment.content.file
def patch_wicked():
try:
from wicked.fieldevent.meta import cleanUp
cleanUp()
except ImportError:
pass
def do_aliases():
sys.modules['opencore.siteui'] = opencore.browser
#sys.modules['opencore.nui'] = opencore.browser
sys.modules['opencore.nui.project'] = opencore.project.browser
sys.modules['opencore.nui.member'] = opencore.member.browser
sys.modules['opencore.nui.member.transient_messages'] = opencore.bbb.transient_messages
sys.modules['opencore.nui.member.interfaces'] = opencore.interfaces.bbb
sys.modules['opencore.nui.project.interfaces'] = opencore.interfaces.bbb
sys.modules['opencore.siteui.interfaces'] = opencore.interfaces.member
# wicked BBB crap
sys.modules['Products.wicked'] = wicked
sys.modules['Products.wicked.lib'] = wicked
sys.modules['Products.wicked.lib.cache'] = wicked.cache # for CacheStore obs
sys.modules['Products.wicked.interfaces'] = wicked.interfaces
sys.modules['Products.wicked.example'] = wicked.atcontent
sys.modules['Products.wicked.example.wickeddoc'] = wicked.atcontent.wickeddoc
# RichDocument -> SimpleAttachment
sys.modules['Products.RichDocument.content.attachments'] = \
Products.SimpleAttachment.content.file
from opencore.interfaces.adding import IAddProject
from opencore.interfaces.adding import IAmANewsFolder
from opencore.interfaces.adding import IAmAPeopleFolder
from opencore.interfaces.membership import IOpenMembership
from opencore.interfaces.pending_requests import IPendingRequests
from opencore.interfaces.workflow import IReadWorkflowPolicySupport
from opencore.interfaces.workflow import IWriteWorkflowPolicySupport
from zope.interface import Interface
from zope.schema import TextLine
class IAddSubProject(Interface):
"""I add sub-projects"""
class IOpenPage(IAmWicked):
"""an openplans wiki page"""
class IMemberFolder(Interface):
""" Marker interface for member folders """
class IOpenSiteRoot(Interface):
""" Marker interface for virtual site roots """
class IConsumeNewMembers(Interface):
""" Marker interface for special projects that consume new members """
class INewsItem(IOpenPage):
from Acquisition import aq_inner
from opencore.interfaces import IOpenPage
from opencore.project.browser.interfaces import IProjectInfo
from wicked.interfaces import IScope
from wicked.interfaces import IAmWickedField
from zope.component import adapts
from zope.interface import implements
class ProjectScope(object):
"""
Defines a scope of within a contained project, or (if none) the
parent container.
"""
implements(IScope)
adapts(IAmWickedField, IOpenPage)
def __init__(self, field, context):
self.field = field
self.context = context
def __call__(self):
# XXX 2009-01-05: This is not hit by any unit tests. Write something?
projectinfo = IProjectInfo(self.context)
scope_obj = projectinfo.project
if scope_obj is None:
scope_obj = aq_parent(aq_inner(self.context))
return '/'.join(scope_obj.getPhysicalPath())
from Acquisition import aq_parent
from Acquisition import aq_inner
from opencore.interfaces import IOpenPage
from opencore.project.browser.interfaces import IProjectInfo
from wicked.interfaces import IScope
from wicked.interfaces import IAmWickedField
from zope.component import adapts
from zope.interface import implements
class ProjectScope(object):
"""
Defines a scope of within a contained project, or (if none) the
parent container.
"""
implements(IScope)
adapts(IAmWickedField, IOpenPage)
def __init__(self, field, context):
self.field = field
self.context = context
def __call__(self):
# XXX 2009-01-05: This is not hit by any unit tests. Write something?
projectinfo = IProjectInfo(self.context)
scope_obj = projectinfo.project
if scope_obj is None:
scope_obj = aq_parent(aq_inner(self.context))
return '/'.join(scope_obj.getPhysicalPath())