コード例 #1
0
def initialize(context):

    from da import (SAWrapper, manage_addSAWrapper, manage_addSAWrapperForm)

    context.registerClass(SAWrapper,
                          constructors=(manage_addSAWrapperForm,
                                        manage_addSAWrapper),
                          permission=ADD_SA_WRAPPER_PERMISSION)

    # make sqlalchemy classes available to untrusted code
    from AccessControl.SecurityInfo import ModuleSecurityInfo, allow_module, allow_class

    from sqlalchemy.orm.session import Session
    from sqlalchemy.orm.query import Query

    allow_class(Session)
    allow_class(Query)
コード例 #2
0
# -*- coding: utf-8 -*-
from AccessControl.SecurityInfo import allow_class
from AccessControl.SecurityInfo import allow_module
from Products.MimetypesRegistry import MimeTypesRegistry
from Products.MimetypesRegistry.interfaces import MimeTypeException  # noqa


# remove when Archetypes are removed:
allow_module('Products.MimetypesRegistry.common')
allow_class(MimeTypeException)
# end remove


def initialize(context):
    from Products.CMFCore import utils
    utils.ToolInit(
        'MimetypesRegistry Tool',
        tools=(MimeTypesRegistry.MimeTypesRegistry, ),
        icon='tool.gif',
    ).initialize(context)
コード例 #3
0
ファイル: zsqlbrain.py プロジェクト: yuanpli/erp5
                inherit_placeless=False)
            if activate_kw:
                new_kw.update(activate_kw)
            new_kw.update(kw)

            # activate returns an ActiveWrapper
            # a queue can be provided as well as extra parameters
            # which can be used for example to define deferred tasks
            return activity_tool.activateObject(self.getPath(),
                                                activity,
                                                active_process,
                                                uid=self.getUid(),
                                                **new_kw)


allow_class(ZSQLBrain)


class ZSQLBrainNoObject(ZSQLBrain):
    security = ClassSecurityInfo()
    security.declareObjectPublic()

    def getObject(self):
        stack = ''.join(traceback.format_stack())
        LOG(
            'Products.ZSQLCatalog.Extentions.zsqlbrain.ZSQLBrainNoObject',
            WARNING, "Attempted direct access to object %r:\n%s" %
            (self.getPath(), stack))
        return None

    def getProperty(self, name, d=_MARKER, **kw):
コード例 #4
0
ファイル: common.py プロジェクト: OpenBfS/dokpool-plone
from plone.app.layout.viewlets.common import ViewletBase
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from AccessControl.SecurityInfo import allow_module, allow_class

allow_module("elan.esd.browser");
allow_module("elan.esd.browser.viewlets");
allow_module("elan.esd.browser.viewlets.common");
        
class TimeViewlet(ViewletBase):
    index = ViewPageTemplateFile('time.pt')
    
allow_class(TimeViewlet)
        
    
コード例 #5
0
ファイル: __init__.py プロジェクト: vedantc98/Plone-test
# -*- coding: utf-8 -*-
from AccessControl.SecurityInfo import allow_class
from AccessControl.SecurityInfo import allow_module
from Products.MimetypesRegistry import MimeTypesRegistry
from Products.MimetypesRegistry.interfaces import MimeTypeException


# remove when Archetypes are removed:
allow_module('Products.MimetypesRegistry.common')
allow_class(MimeTypeException)
# end remove


def initialize(context):
    from Products.CMFCore import utils
    utils.ToolInit(
        'MimetypesRegistry Tool',
        tools=(MimeTypesRegistry.MimeTypesRegistry, ),
        icon='tool.gif',
    ).initialize(context)
コード例 #6
0
ファイル: zsqlbrain.py プロジェクト: Provab-Solutions/erp5
      Attempt to resolve a url into an object in the Zope
      namespace. The url may be absolute or a catalog path
      style url. If no object is found, None is returned.
      No exceptions are raised.
    """
    script=REQUEST.script
    if string.find(path, script) != 0:
      path='%s/%s' % (script, path)
    try:
      return REQUEST.resolve_url(path)
    except ConflictError:
      raise
    except:
      pass

allow_class(ZSQLBrain)

class ZSQLBrainNoObject(ZSQLBrain):
  security = ClassSecurityInfo()
  security.declareObjectPublic()
  
  def getObject(self):
    stack = ''.join(traceback.format_stack())
    LOG('Products.ZSQLCatalog.Extentions.zsqlbrain.ZSQLBrainNoObject', WARNING,
        "Attempted direct access to object %r:\n%s" % (self.getPath(), stack))
    return None

  def getProperty(self, name, d=_MARKER, **kw):
    value = None
    if hasattr(self, name):
      value = getattr(self, name)
コード例 #7
0
ファイル: SOAPWSDLConnection.py プロジェクト: MarkTang/erp5
    self.info = info

  def getCode(self):
    return self.code

  def getName(self):
    return self.name

  def getInfo(self):
    return self.info

  def __str__(self):
    return '<%s at 0x%x: %r %r %r>' % (self.__class__.__name__, id(self),
       self.name, self.code, self.info)

allow_class(SOAPWSDLException)

# Authentication classes.
#  These are SOAP authentication classes.
#  They are supposed to be instanciated and then transmited to WebServiceTool
#  in order to create a connection.

class AuthenticationBase(object):
  """
    Authentication API.

    As SOAP doens't provide a standard authentication method, authentication
    plugins must be written for virtualy each SOAP services.
    This API intends to provide hooks for authentication purposes.

    Overload the methods you need (default methods are NO-OPs).
コード例 #8
0
ファイル: PDFForm.py プロジェクト: Provab-Solutions/erp5
  security = ClassSecurityInfo()
  def __init__(self, values, key, not_founds) :
    """ 'values' are a dict of already calculated values
    'key' is the key we are evaluating
    'not_founds' is the list in which we will put not found values  """
    self.__values      = values
    self.__key         = key
    self.__not_founds  = not_founds
  def __getitem__(self, attr) :
    if not self.__values.has_key(attr) :
      self.__not_founds.append(attr)
      return 0 # We do not return None, so that cell['a1'] + cell['a2']
      # doesn't complain that NoneType doesn't support + when a1 not found
    return self.__values[attr]
  __getattr__ = __getitem__
allow_class(CalculatedValues)


class CircularReferencyError(ValueError):
  """A circular reference is found trying to evaluate cell TALES."""


class EmptyERP5PdfFormError(Exception):
  """Error thrown when you try to display an empty Pdf. """
allow_class(EmptyERP5PdfFormError)



class PDFForm(File):
  """This class allows to fill PDF Form with TALES expressions,
    using a TALES expression for each cell.
コード例 #9
0
    self.info = info

  def getCode(self):
    return self.code

  def getName(self):
    return self.name

  def getInfo(self):
    return self.info

  def __str__(self):
    return '<%s at 0x%x: %r %r %r>' % (self.__class__.__name__, id(self),
       self.name, self.code, self.info)

allow_class(SOAPWSDLException)

# Authentication classes.
#  These are SOAP authentication classes.
#  They are supposed to be instanciated and then transmited to WebServiceTool
#  in order to create a connection.

class AuthenticationBase(object):
  """
    Authentication API.

    As SOAP doens't provide a standard authentication method, authentication
    plugins must be written for virtualy each SOAP services.
    This API intends to provide hooks for authentication purposes.

    Overload the methods you need (default methods are NO-OPs).
コード例 #10
0
ファイル: PDFForm.py プロジェクト: poses/erp5
  security = ClassSecurityInfo()
  def __init__(self, values, key, not_founds) :
    """ 'values' are a dict of already calculated values
    'key' is the key we are evaluating
    'not_founds' is the list in which we will put not found values  """
    self.__values      = values
    self.__key         = key
    self.__not_founds  = not_founds
  def __getitem__(self, attr) :
    if not self.__values.has_key(attr) :
      self.__not_founds.append(attr)
      return 0 # We do not return None, so that cell['a1'] + cell['a2']
      # doesn't complain that NoneType doesn't support + when a1 not found
    return self.__values[attr]
  __getattr__ = __getitem__
allow_class(CalculatedValues)


class CircularReferencyError(ValueError):
  """A circular reference is found trying to evaluate cell TALES."""


class EmptyERP5PdfFormError(Exception):
  """Error thrown when you try to display an empty Pdf. """
allow_class(EmptyERP5PdfFormError)



class PDFForm(File):
  """This class allows to fill PDF Form with TALES expressions,
    using a TALES expression for each cell.
コード例 #11
0
ファイル: recent.py プロジェクト: OpenBfS/dokpool-plone
        for c in clist:
          if c not in [over, rec] and c.encode('utf') not in [over, rec]:
             cats = cats + c + ', '
        cats = '(' + cats + ')'
        cats = string.replace(cats,', )',')')
        return cats
#        return codecs.decode(codecs.decode(z,'hex'),'ascii')

    @memoize
    def _data(self):
        try:
            return self.collection.results(batch=True, b_start=0, b_size=5, sort_on=None, brains=True)
        except:
            return []
    ##/code-section renderer-methods
 
##code-section forms    
class AddForm(base.NullAddForm):
    
    # This method must be implemented to actually construct the object.

    def create(self):
        return Assignment()
##/code-section forms

##code-section bottom
allow_module("docpool.base.portlets");
allow_module("docpool.base.portlets.recent");
allow_class(Renderer);
##/code-section bottom