Exemple #1
0
    def listPropertysheets( self ):

        """ -> [ propertysheet_id ]
        """
        return self._propertysheets.keys()

    def getPropertysheet( self, id ):

        """ id -> sheet

        o Raise KeyError if no such seet exists.
        """
        return self._propertysheets[ id ]

    __getitem__ = getPropertysheet

    def addPropertysheet( self, id, data ):

        """ Add a new propertysheet.

        o Raise KeyError if a sheet of the given ID already exists.
        """
        if self._propertysheets.get( id ) is not None:
            raise KeyError, "Duplicate property sheet: %s" % id

        self._propertysheets[ id ] = UserPropertySheet( id, **data )


classImplements( PropertiedUser,
                 IPropertiedUser )
Exemple #2
0
        if login_pw is not None:
            name, password = login_pw

            creds['login'] = name
            creds['password'] = password
            creds['remote_host'] = request.get('REMOTE_HOST', '')

            try:
                creds['remote_address'] = request.getClientAddr()
            except AttributeError:
                creds['remote_address'] = request.get('REMOTE_ADDR', '')

        return creds


classImplements(DumbHTTPExtractor, ILoginPasswordHostExtractionPlugin)

InitializeClass(DumbHTTPExtractor)


class EmergencyUserAuthenticator(Implicit):

    security = ClassSecurityInfo()

    security.declarePrivate('authenticateCredentials')

    def authenticateCredentials(self, credentials):
        """ Check credentials against the emergency user.
        """
        if isinstance(credentials, dict):
Exemple #3
0
    #
    def listPropertysheets(self):
        """ -> [ propertysheet_id ]
        """
        return self._propertysheets.keys()

    def getPropertysheet(self, id):
        """ id -> sheet

        o Raise KeyError if no such seet exists.
        """
        return self._propertysheets[id]

    __getitem__ = getPropertysheet

    def addPropertysheet(self, id, data):
        """ Add a new propertysheet.

        o Raise KeyError if a sheet of the given ID already exists.
        """
        if self._propertysheets.get(id) is not None:
            raise KeyError, "Duplicate property sheet: %s" % id

        if IPropertySheet.providedBy(data):
            self._propertysheets[id] = data
        else:
            self._propertysheets[id] = UserPropertySheet(id, **data)


classImplements(PropertiedUser, IPropertiedUser)
Exemple #4
0
        if login_pw is not None:
            name, password = login_pw

            creds[ 'login' ] = name
            creds[ 'password' ] = password
            creds[ 'remote_host' ] = request.get( 'REMOTE_HOST', '' )

            try:
                creds[ 'remote_address' ] = request.getClientAddr()
            except AttributeError:
                creds[ 'remote_address' ] = request.get( 'REMOTE_ADDR', '' )

        return creds

classImplements( DumbHTTPExtractor
               , ILoginPasswordHostExtractionPlugin
               )

InitializeClass( DumbHTTPExtractor )


class EmergencyUserAuthenticator( Implicit ):

    security = ClassSecurityInfo()

    security.declarePrivate( 'authenticateCredentials' )
    def authenticateCredentials( self, credentials ):

        """ Check credentials against the emergency user.
        """
        if isinstance( credentials, dict ):
Exemple #5
0
        if login_pw is not None:
            name, password = login_pw

            creds[ 'login' ] = name
            creds[ 'password' ] = password
            creds[ 'remote_host' ] = request.get( 'REMOTE_HOST', '' )

            try:
                creds[ 'remote_address' ] = request.getClientAddr()
            except AttributeError:
                creds[ 'remote_address' ] = request.get( 'REMOTE_ADDR', '' )

        return creds

classImplements( DumbHTTPExtractor
               , ILoginPasswordHostExtractionPlugin
               )

InitializeClass( DumbHTTPExtractor )


class EmergencyUserAuthenticator( Implicit ):

    security = ClassSecurityInfo()

    security.declarePrivate( 'authenticateCredentials' )
    def authenticateCredentials( self, credentials ):

        """ Check credentials against the emergency user.
        """
        if isinstance( credentials, dict ):
Exemple #6
0
        result = []
        for s in lst:
            # This is a hack to get the word splitting working with
            # non-unicode text.
            try:
                if not isinstance(s, unicode):
                    s = unicode(s, enc)
            except (UnicodeDecodeError, TypeError):
                # Fall back to locale aware splitter
                result += self.rxGlob_L.findall(s)
            else:
                words = self.rxGlob_U.findall(s)
                result += [w.encode(enc) for w in words]
        return result

classImplements(Splitter, Splitter.__implements__)

try:
    element_factory.registerFactory('Word Splitter',
        'Unicode Whitespace splitter', Splitter)
except ValueError:
    # In case the splitter is already registered, ValueError is raised
    pass

class CaseNormalizer:

    def process(self, lst):
        result = []
        for s in lst:
            # This is a hack to get the normalizer working with
            # non-unicode text.
Exemple #7
0
        if login_pw is not None:
            name, password = login_pw

            creds['login'] = name
            creds['password'] = password
            creds['remote_host'] = request.get('REMOTE_HOST', '')

            try:
                creds['remote_address'] = request.getClientAddr()
            except AttributeError:
                creds['remote_address'] = request.get('REMOTE_ADDR', '')

        return creds


classImplements(DumbHTTPExtractor, ILoginPasswordHostExtractionPlugin)

InitializeClass(DumbHTTPExtractor)


class EmergencyUserAuthenticator(Implicit):

    security = ClassSecurityInfo()

    security.declarePrivate('authenticateCredentials')

    def authenticateCredentials(self, credentials):
        """ Check credentials against the emergency user.
        """
        if isinstance(credentials, dict):