def _load_config(self): dinj_config = None if hasattr(self, 'self._config') and self._config: return self._config else: try: try: # first assume opts in OptionParser if self._opts and self._opts.CONFIG: dinj_config = DinjLexicon(parsable=self._opts.CONFIG) except: # if not assume opts are a dict, collected from ConfigParser if self._opts and 'pyaella_config' in self._opts: dinj_config = \ DinjLexicon(parsable=self._opts['pyaella_config']) except: # lastly, look for config in environ print traceback.format_exc() if PSDC in os.environ: dinj_config = DinjLexicon( parsable=os.environ[PSDC]) if dinj_config: # set for safe keeping #os.environ[PSDC] = dinj_config.__parsable try: global APP_CONFIG AppConfig = __borg_cls__('AppConfig') if 'App' in dinj_config and 'AppId' in dinj_config.App: app_kseq = get_app_kseq( int(dinj_config.App.AppId), get_master_kseq()) d = dict(dinj_config.App.items()) d['AppKeySeq'] = app_kseq d['FullConfigPath'] = os.path.abspath(self._opts.CONFIG) APP_CONFIG = AppConfig(**d) global MODEL_SCHEMA_CONFIG MODEL_SCHEMA_CONFIG = __borg_lex__('ModelConfig')( parsable=dinj_config.Resources.Schema) except: print 'Ignoring exception', traceback.format_exc() else: raise Exception( 'Error during configuration injection. ' + 'Can not start cooking without the ingredients.' ) return dinj_config
def load_config(): """Inject dependencies """ global CONFIG dinj_config = DinjLexicon(parsable=OPTS.CONFIG) CONFIG = dinj_config global APP_CONFIG AppConfig = __borg_cls__('AppConfig') app_kseq = get_app_kseq( int(dinj_config.App.AppId), get_master_kseq()) d = dict(dinj_config.App.items()) d['AppKeySeq'] = app_kseq APP_CONFIG = AppConfig(**d) global MODEL_SCHEMA_CONFIG MODEL_SCHEMA_CONFIG = __borg_lex__('ModelConfig')( parsable=dinj_config.Resources.Schema)
except: pass from pyramid.security import Allow, Everyone from pyaella import Mixable, Mix, orm from pyaella.orm import * from pyaella.orm.xsqlalchemy import PyaellaSQLAlchemyBase, SQLAlchemySessionFactory from pyaella.dinj import BorgLexicon, __borg_lex__ Base = declarative_base(cls=PyaellaSQLAlchemyBase) ReflBase = declarative_base(cls=DeferredReflection) __autogen_date__ = "2015-08-30 11:48:24.132616" __schema_file__ = os.path.join(os.path.dirname(__file__), "domain.plr") MODEL_SCHEMA_CONFIG = __borg_lex__('ModelConfig')(parsable=__schema_file__) __all__ = [ "ApplicationDomain", "Application", "Group", "UserXGroup", "UserTypeLookup", "UserXUserTypeLookup", "User", "UserXApplication", "GameObject", ] class ApplicationDomain(PyaellaDataModel):