本文整理匯總了Python中galaxy.util.bunch.Bunch.context方法的典型用法代碼示例。如果您正苦於以下問題:Python Bunch.context方法的具體用法?Python Bunch.context怎麽用?Python Bunch.context使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類galaxy.util.bunch.Bunch
的用法示例。
在下文中一共展示了Bunch.context方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Bunch
# 需要導入模塊: from galaxy.util.bunch import Bunch [as 別名]
# 或者: from galaxy.util.bunch.Bunch import context [as 別名]
import sys
sys.path.insert(1,'/galaxy-central')
sys.path.insert(1,'/galaxy-central/lib')
from scripts.db_shell import *
from galaxy.util.bunch import Bunch
from galaxy.security import GalaxyRBACAgent
from sqlalchemy.orm import sessionmaker
from sqlalchemy import *
import argparse
bunch = Bunch( **globals() )
engine = create_engine('postgres://galaxy:[email protected]:5432/galaxy')
bunch.session = sessionmaker(bind=engine)
# For backward compatibility with "model.context.current"
bunch.context = sessionmaker(bind=engine)
security_agent = GalaxyRBACAgent( bunch )
security_agent.sa_session = sa_session
def add_user(email, password, key=None):
"""
Add Galaxy User.
From John https://gist.github.com/jmchilton/4475646
"""
query = sa_session.query( User ).filter_by( email=email )
if query.count() > 0:
return query.first()
else:
User.use_pbkdf2 = False
user = User(email)