from ferris import plugins plugins.register('angular', templating=False) import ferris import os from ferris.core import template template.add_template_path( os.path.normpath(os.path.join( os.path.dirname(ferris.__file__), '../angular-app/templates')), 'angular')
from ferris import plugins, settings, ndb plugins.register('service_account') from plugins.settings import SettingModel class ServiceAccountSettings(SettingModel): _name = 'OAuth2 Service Account' _settings_key = 'oauth2_service_account' domain = ndb.StringProperty(indexed=False, verbose_name="The Google Apps Domain") default_user = ndb.StringProperty( indexed=False, verbose_name="The email of the user to impersonate by default") client_email = ndb.StringProperty( indexed=False, verbose_name="*****@*****.**") private_key = ndb.TextProperty(verbose_name="PEM Format") def get_config(): config = settings.get('oauth2_service_account') if not config['private_key'] or not config['client_email'] or not config[ 'domain']: raise RuntimeError( "OAuth2 Service Account is not configured correctly") return config from oauth2client.client import SignedJwtAssertionCredentials
from ferris import plugins, settings, ndb import hashlib plugins.register('service_account') def get_config(): config = settings.get('oauth2_service_account') if not config['private_key'] or not config['client_email'] or not config['domain']: raise RuntimeError("OAuth2 Service Account is not configured correctly") return config from oauth2client.client import SignedJwtAssertionCredentials from oauth2client.appengine import StorageByKeyName, CredentialsNDBProperty def build_credentials(scope, user=None): """ Builds service account credentials using the configuration stored in settings and masquerading as the provided user. """ config = get_config() if not user: user = config['default_user'] if not isinstance(scope, (list, tuple)): scope = [scope] key = generate_storage_key(config['client_email'], scope, user)
from ferris import plugins, settings from sqlalchemy import create_engine plugins.register('sqlalchemy') db = settings.get('database') engine = create_engine(db.get('connect_string'), **db.get('args'))
from ferris import plugins plugins.register('google_directory') from client import * import monkey