示例#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
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
# -*- 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
      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
    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
  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
        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