本文整理汇总了Python中stalker.db.DBSession.remove方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.remove方法的具体用法?Python DBSession.remove怎么用?Python DBSession.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stalker.db.DBSession
的用法示例。
在下文中一共展示了DBSession.remove方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tearDown
# 需要导入模块: from stalker.db import DBSession [as 别名]
# 或者: from stalker.db.DBSession import remove [as 别名]
def tearDown(self):
"""clean up the test
"""
from stalker.db import DBSession
DBSession.remove()
# and remove the temp directory
shutil.rmtree(self.temp_config_folder)
# restore defaults.timing_resolution
stalker.defaults.timing_resolution = datetime.timedelta(hours=1)
示例2: tearDown
# 需要导入模块: from stalker.db import DBSession [as 别名]
# 或者: from stalker.db.DBSession import remove [as 别名]
def tearDown(self):
"""clean up test
"""
DBSession.remove()
示例3: setUpClass
# 需要导入模块: from stalker.db import DBSession [as 别名]
# 或者: from stalker.db.DBSession import remove [as 别名]
def setUpClass(cls):
"""set up the test in class level
"""
DBSession.remove()
DBSession.configure(extension=None)
示例4: tearDownClass
# 需要导入模块: from stalker.db import DBSession [as 别名]
# 或者: from stalker.db.DBSession import remove [as 别名]
def tearDownClass(cls):
"""cleanup the test
"""
DBSession.remove()
DBSession.configure(extension=None)
示例5: tearDownClass
# 需要导入模块: from stalker.db import DBSession [as 别名]
# 或者: from stalker.db.DBSession import remove [as 别名]
def tearDownClass(cls):
"""clean up the test in class level
"""
DBSession.remove()
示例6: setUp
# 需要导入模块: from stalker.db import DBSession [as 别名]
# 或者: from stalker.db.DBSession import remove [as 别名]
def setUp(self):
"""setup the test
"""
DBSession.remove()
db.setup()
defaults.local_storage_path = tempfile.mktemp()
示例7: setUpClass
# 需要导入模块: from stalker.db import DBSession [as 别名]
# 或者: from stalker.db.DBSession import remove [as 别名]
def setUpClass(cls):
"""setting up the test in class level
"""
DBSession.remove()
示例8: test_generic_data_attribute_can_hold_a_wide_variety_of_object_types
# 需要导入模块: from stalker.db import DBSession [as 别名]
# 或者: from stalker.db.DBSession import remove [as 别名]
def test_generic_data_attribute_can_hold_a_wide_variety_of_object_types(self):
"""testing if the generic_data attribute can hold any kind of object as
a list
"""
from stalker import db
db.setup()
new_simple_entity = SimpleEntity(**self.kwargs)
test_user = User(
name='email',
login='email',
email='[email protected]',
password='email',
)
from stalker import Department
test_department = Department(
name='department1'
)
from stalker import Repository
test_repo = Repository(
name='Test Repository'
)
from stalker import Structure
test_struct = Structure(
name='Test Project Structure'
)
from stalker import Status, StatusList
test_project_status_list = StatusList(
name='Project Status List',
target_entity_type='Project',
statuses=[
Status(name='Active', code='ACT')
]
)
from stalker import Project
test_proj = Project(
name='Test Project 1',
code='tp1',
repository=test_repo,
structure=test_struct,
status_list=test_project_status_list
)
new_simple_entity.generic_data.extend(
[test_proj, test_project_status_list, test_struct, test_repo,
test_department, test_user]
)
DBSession.add(new_simple_entity)
DBSession.commit()
# now check if it is added to the database correctly
del new_simple_entity
new_simple_entity_db = SimpleEntity.query \
.filter_by(name=self.kwargs['name']) \
.first()
self.assertTrue(test_proj in new_simple_entity_db.generic_data)
self.assertTrue(
test_project_status_list in new_simple_entity_db.generic_data)
self.assertTrue(test_struct in new_simple_entity_db.generic_data)
self.assertTrue(test_repo in new_simple_entity_db.generic_data)
self.assertTrue(test_department in new_simple_entity_db.generic_data)
self.assertTrue(test_user in new_simple_entity_db.generic_data)
DBSession.remove()
示例9: main
# 需要导入模块: from stalker.db import DBSession [as 别名]
# 或者: from stalker.db.DBSession import remove [as 别名]
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
from pyramid.config import Configurator
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
# setup the database to the given settings
from stalker import db
from stalker.db import DBSession
# use the ZopeTransactionExtension for session
db.setup(settings)
DBSession.remove()
DBSession.configure(extension=ZopeTransactionExtension())
# setup authorization and authentication
authn_policy = AuthTktAuthenticationPolicy(
'sosecret',
hashalg='sha512',
callback=group_finder
)
authz_policy = ACLAuthorizationPolicy()
config = Configurator(
settings=settings,
root_factory='stalker.models.auth.RootFactory'
)
config.set_authentication_policy(authn_policy)
config.set_authorization_policy(authz_policy)
# Configure Beaker sessions and caching
session_factory = pyramid_beaker.session_factory_from_settings(settings)
config.set_session_factory(session_factory)
pyramid_beaker.set_cache_regions_from_settings(settings)
config.include('pyramid_jinja2')
config.include('pyramid_mailer')
config.add_static_view('static', 'static', cache_max_age=3600)
# *************************************************************************
# Basics
config.add_route('deform_test', '/deform_test')
config.add_route('home', '/')
config.add_route('me_menu', '/me_menu')
config.add_route('signin', '/signin')
config.add_route('login', '/login')
config.add_route('logout', '/logout')
config.add_route('flash_message', '/flash_message')
# addresses like http:/localhost:6543/SPL/{some_path} will let SP to serve
# those files
# SPL : Stalker Pyramid Local
config.add_route(
'serve_files',
'SPL/{partial_file_path:[a-zA-Z0-9/\.]+}'
)
# addresses like http:/localhost:6543/FDSPL/{some_path} will serve the
# files with their original filename in a forced download mode.
# FDSPL : Forced Download Stalker Pyramid Local
config.add_route(
'forced_download_files',
'FDSPL/{partial_file_path:[a-zA-Z0-9/\.]+}'
)
logger.debug(defaults.server_side_storage_path + '/{partial_file_path}')
# *************************************************************************
# DATA VIEWS
# *************************************************************************
# *************************************************************************
# Entities
config.add_route('get_search_result', '/search') # json
config.add_route('list_search_result', '/list/search_results')
config.add_route('submit_search', '/submit_search')
config.add_route('upload_entity_thumbnail_dialog', 'entities/{id}/thumbnail/upload/dialog')
config.add_route('upload_entity_reference_dialog', 'entities/{id}/references/upload/dialog')
config.add_route('create_entity_users_dialog', 'entities/{id}/users/create/dialog')
config.add_route('append_users_to_entity_dialog', 'entities/{id}/users/append/dialog')
config.add_route('append_users_to_entity', 'entities/{id}/users/append')
config.add_route('remove_entity_from_entity_dialog','entities/{id}/{entity_id}/remove/dialog')
config.add_route('remove_entity_from_entity', 'entities/{id}/{entity_id}/remove')
config.add_route('delete_entity_dialog', 'entities/{id}/delete/dialog')
config.add_route('delete_entity', 'entities/{id}/delete')
config.add_route('create_entity_note', 'entities/{id}/note/create')
config.add_route('delete_note_dialog', 'notes/{id}/delete/dialog')
config.add_route('delete_note', 'notes/{id}/delete')
# get routes returns json
config.add_route('get_entity', 'entities/{id}/')
#.........这里部分代码省略.........
示例10: setUp
# 需要导入模块: from stalker.db import DBSession [as 别名]
# 或者: from stalker.db.DBSession import remove [as 别名]
def setUp(self):
"""setup the test
"""
self.config = testing.setUp()
db.setup({'sqlalchemy.url': 'sqlite:///:memory:'})
db.init()
DBSession.remove()
# test users
self.user1 = User(
name='Test User 1',
login='tuser1',
email='[email protected]',
password='secret'
)
DBSession.add(self.user1)
# create a couple of tasks
self.status_new = Status(name='New', code='NEW')
self.status_rts = Status(name='Ready To Start', code='RTS')
self.status_wip = Status(name='Work In Progress', code='WIP')
self.status_prev = Status(name='Pending Review', code='PREV')
self.status_hrev = Status(name='Has Revisions', code='HREV')
self.status_cmpl = Status(name='Complete', code='CMPL')
self.project_status_list = StatusList(
name='Project Statuses',
target_entity_type='Project',
statuses=[self.status_new, self.status_wip, self.status_cmpl]
)
DBSession.add(self.project_status_list)
self.task_status_list = StatusList(
name='Task Statuses',
target_entity_type='Task',
statuses=[self.status_new, self.status_rts, self.status_wip,
self.status_prev, self.status_hrev, self.status_cmpl]
)
DBSession.add(self.task_status_list)
# repo
self.repo = Repository(
name='Test Repository'
)
DBSession.add(self.repo)
# proj1
self.proj1 = Project(
name='Test Project',
code='TProj1',
status_list=self.project_status_list,
repository=self.repo,
lead=self.user1
)
DBSession.add(self.proj1)
# tasks
self.task1 = Task(
name='Test Task 1',
project=self.proj1,
status_list=self.task_status_list,
status=self.status_new,
resources=[self.user1],
schedule_timing=5,
schedule_unit='d',
schedule_model='effort'
)
DBSession.add(self.task1)
transaction.commit()
示例11: tearDown
# 需要导入模块: from stalker.db import DBSession [as 别名]
# 或者: from stalker.db.DBSession import remove [as 别名]
def tearDown(self):
DBSession.remove()
testing.tearDown()