authomatic/extras/gae/__init__.py
def initialize(cls):
        """
        Creates an **"Example"** entity of kind **"NDBConfig"** in the
        datastore if the model is empty and raises and error to inform you that
        you should populate the model with data.

        .. note::

            The *Datastore Viewer* in the ``_ah/admin/`` won't let you add
            properties to a model if there is not an entity with that
            property already. Therefore it is a good idea to keep the
            **"Example"** entity (which has all possible properties set) in
            the datastore.

        """

        if not len(cls.query().fetch()):

            example = cls.get_or_insert('Example')

            example.class_ = 'Provider class e.g. ' + \
                             '"authomatic.providers.oauth2.Facebook".'
            example.provider_name = 'Your custom provider name e.g. "fb".'

            # AuthorizationProvider
            example.consumer_key = 'Consumer key.'
            example.consumer_secret = 'Consumer secret'
            example.provider_id = 1

            # OAuth2
            example.scope = 'coma, separated, list, of, scopes'

            # AuthenticationProvider
            example.identifier_param = 'Querystring parameter for claimed ' + \
                                       'id. default is "id"'

            # Save the example
            example.put()

            # Raise an information error.
            raise GAEError(
                'A NDBConfig data model was created! Go to Datastore Viewer '
                'in your dashboard and populate it with data!')
def initialize(cls):
        """
        Creates an **"Example"** entity of kind **"NDBConfig"** in the
        datastore if the model is empty and raises and error to inform you that
        you should populate the model with data.

        .. note::

            The *Datastore Viewer* in the ``_ah/admin/`` won't let you add
            properties to a model if there is not an entity with that
            property already. Therefore it is a good idea to keep the
            **"Example"** entity (which has all possible properties set) in
            the datastore.

        """

        if not len(cls.query().fetch()):

            example = cls.get_or_insert('Example')

            example.class_ = 'Provider class e.g. ' + \
                             '"authomatic.providers.oauth2.Facebook".'
            example.provider_name = 'Your custom provider name e.g. "fb".'

            # AuthorizationProvider
            example.consumer_key = 'Consumer key.'
            example.consumer_secret = 'Consumer secret'
            example.provider_id = 1

            # OAuth2
            example.scope = 'coma, separated, list, of, scopes'

            # AuthenticationProvider
            example.identifier_param = 'Querystring parameter for claimed ' + \
                                       'id. default is "id"'

            # Save the example
            example.put()

            # Raise an information error.
            raise GAEError(
                'A NDBConfig data model was created! Go to Datastore Viewer '
                'in your dashboard and populate it with data!')
def initialize ( cls ) : if not len ( cls . query ( ) . fetch ( ) ) : example = cls . get_or_insert ( 'Example' ) example . class_ = 'Provider class e.g. ' + '"authomatic.providers.oauth2.Facebook".' example . provider_name = 'Your custom provider name e.g. "fb".' # AuthorizationProvider example . consumer_key = 'Consumer key.' example . consumer_secret = 'Consumer secret' example . provider_id = 1 # OAuth2 example . scope = 'coma, separated, list, of, scopes' # AuthenticationProvider example . identifier_param = 'Querystring parameter for claimed ' + 'id. default is "id"' # Save the example example . put ( ) # Raise an information error. raise GAEError ( 'A NDBConfig data model was created! Go to Datastore Viewer ' 'in your dashboard and populate it with data!' )
Creates an **"Example"** entity of kind **"NDBConfig"** in the
        datastore if the model is empty and raises and error to inform you that
        you should populate the model with data.

        .. note::

            The *Datastore Viewer* in the ``_ah/admin/`` won't let you add
            properties to a model if there is not an entity with that
            property already. Therefore it is a good idea to keep the
            **"Example"** entity (which has all possible properties set) in
            the datastore.
Creates an ** Example ** entity of kind ** NDBConfig ** in the datastore if the model is empty and raises and error to inform you that you should populate the model with data .