def setup(settings=None): """Utility function that helps to connect the system to the given database. if the database is None then the it setups using the default database in the settings file. :param settings: This is a dictionary which has keys prefixed with "sqlalchemy" and shows the settings. The most important one is the engine. The default is None, and in this case it uses the settings from stalker.config.Config.database_engine_settings """ if settings is None: settings = defaults.database_engine_settings logger.debug("no settings given, using the default: %s" % settings) logger.debug("settings: %s" % settings) # create engine engine = engine_from_config(settings, "sqlalchemy.") logger.debug("engine: %s" % engine) # create the Session class DBSession.remove() DBSession.configure(bind=engine, extension=None) # create the database logger.debug("creating the tables") Base.metadata.create_all(engine) # update defaults update_defaults_with_studio()
def tearDown(self): os.rmdir(self.test_repo.linux_path) os.rmdir(self.test_repo.windows_path) os.rmdir(self.test_repo.osx_path) DBSession.remove() testing.tearDown()
def tearDownClass(cls): """teardown once """ from anima import defaults shutil.rmtree(defaults.local_storage_path, True) shutil.rmtree(cls.repo_path) # configure with transaction manager DBSession.remove()
def tearDown(self): """cleanup the test """ # set the db.session to None DBSession.remove() # delete the temp folder shutil.rmtree(self.temp_repo_path, ignore_errors=True) for f in self.remove_these_files_buffer: if os.path.isfile(f): os.remove(f) elif os.path.isdir(f): shutil.rmtree(f, True)
def tearDownClass(cls): """cleanup the test """ # set the db.session to None from stalker.db.session import DBSession DBSession.remove() # delete the temp folder shutil.rmtree(cls.temp_repo_path, ignore_errors=True) for f in cls.remove_these_files_buffer: if os.path.isfile(f): os.remove(f) elif os.path.isdir(f): shutil.rmtree(f, True)
def setup(settings=None): """Utility function that helps to connect the system to the given database. if the database is None then the it setups using the default database in the settings file. :param settings: This is a dictionary which has keys prefixed with "sqlalchemy" and shows the settings. The most important one is the engine. The default is None, and in this case it uses the settings from stalker.config.Config.database_engine_settings """ if settings is None: from stalker import defaults settings = defaults.database_engine_settings logger.debug('no settings given, using the default setting') # logger.debug("settings: %s" % settings) # create engine from sqlalchemy import engine_from_config engine = engine_from_config(settings, 'sqlalchemy.') logger.debug('engine: %s' % engine) # create the Session class from stalker.db.session import DBSession DBSession.remove() DBSession.configure( bind=engine, extension=None ) # check alembic versions of the database # and raise an error if it is not matching with the system check_alembic_version() # create the database logger.debug("creating the tables") from stalker.db.declarative import Base Base.metadata.create_all(engine) DBSession.commit() # update defaults update_defaults_with_studio() # create repo env variables create_repo_vars()
def tearDown(self): """clean up the test """ import datetime from stalker import defaults from stalker.db.declarative import Base from stalker.db.session import DBSession # clean up test database DBSession.rollback() connection = DBSession.connection() engine = connection.engine connection.close() Base.metadata.drop_all(engine, checkfirst=True) DBSession.remove() defaults.timing_resolution = datetime.timedelta(hours=1)
def setup(settings=None): """Utility function that helps to connect the system to the given database. if the database is None then the it setups using the default database in the settings file. :param settings: This is a dictionary which has keys prefixed with "sqlalchemy" and shows the settings. The most important one is the engine. The default is None, and in this case it uses the settings from stalker.config.Config.database_engine_settings """ if settings is None: settings = defaults.database_engine_settings logger.debug('no settings given, using the default: %s' % settings) logger.debug("settings: %s" % settings) # create engine engine = engine_from_config(settings, 'sqlalchemy.') logger.debug('engine: %s' % engine) # create the Session class DBSession.remove() DBSession.configure( bind=engine, extension=None ) # check alembic versions of the database # and raise an error if it is not matching with the system check_alembic_version() # create the database logger.debug("creating the tables") Base.metadata.create_all(engine) # update defaults update_defaults_with_studio() # create repo env variables create_repo_vars()
def tearDown(self): """clean up the test """ import datetime import transaction from stalker import defaults from stalker.db.session import DBSession from stalker.db.declarative import Base from pyramid import testing testing.tearDown() # clean up test database connection = DBSession.connection() engine = connection.engine connection.close() Base.metadata.drop_all(engine) transaction.commit() DBSession.remove() defaults.timing_resolution = datetime.timedelta(hours=1)
def setup(settings=None): """Utility function that helps to connect the system to the given database. if the database is None then the it setups using the default database in the settings file. :param settings: This is a dictionary which has keys prefixed with "sqlalchemy" and shows the settings. The most important one is the engine. The default is None, and in this case it uses the settings from stalker.config.Config.database_engine_settings """ if settings is None: settings = defaults.database_engine_settings logger.debug('no settings given, using the default: %s' % settings) logger.debug("settings: %s" % settings) # create engine engine = engine_from_config(settings, 'sqlalchemy.') logger.debug('engine: %s' % engine) # create the Session class DBSession.remove() DBSession.configure( bind=engine, extension=None ) # create the database logger.debug("creating the tables") Base.metadata.create_all(engine) # update defaults update_defaults_with_studio() # create repo env variables create_repo_vars()
def tearDownClass(cls): """clear test in class level """ DBSession.remove()
def setUpClass(cls): """setup test in class level """ DBSession.remove()
def tearDown(self): from stalker.db.session import DBSession DBSession.remove()
def setUpClass(cls): """setup the test in class level """ DBSession.remove() DBSession.configure()
def tearDown(self): """clean up the test """ DBSession.remove() # restore defaults.timing_resolution defaults.timing_resolution = datetime.timedelta(hours=1)
def setUp(self): """setup the test """ DBSession.remove() db.setup() # statuses self.test_status1 = Status(name="Status1", code="STS1") self.test_status2 = Status(name="Status2", code="STS2") self.test_status3 = Status(name="Status3", code="STS3") self.test_status4 = Status(name="Status4", code="STS4") self.test_status5 = Status(name="Status5", code="STS5") # status lists self.test_project_status_list = StatusList( name="Project Status List", statuses=[self.test_status1, self.test_status2, self.test_status3, self.test_status4, self.test_status5], target_entity_type=Project, ) self.test_sequence_status_list = StatusList( name="Sequence Status List", statuses=[self.test_status1, self.test_status2, self.test_status3, self.test_status4, self.test_status5], target_entity_type=Sequence, ) self.test_shot_status_list = StatusList( name="Shot Status List", statuses=[self.test_status1, self.test_status2, self.test_status3, self.test_status4, self.test_status5], target_entity_type=Shot, ) self.test_task_status_list = StatusList( name="Task Status List", statuses=[self.test_status1, self.test_status2, self.test_status3, self.test_status4, self.test_status5], target_entity_type=Task, ) self.test_version_status_list = StatusList( name="Version Status List", statuses=[self.test_status1, self.test_status2, self.test_status3, self.test_status4, self.test_status5], target_entity_type=Version, ) # repository self.test_repo = Repository( name="Test Repository", linux_path="/mnt/T/", windows_path="T:/", osx_path="/Volumes/T/" ) # a project type self.test_project_type = Type(name="Test", code="test", target_entity_type=Project) # create a structure self.test_structure = Structure(name="Test Project Structure") # create a project self.test_project = Project( name="Test Project", code="tp", type=self.test_project_type, status_list=self.test_project_status_list, repository=self.test_repo, structure=self.test_structure, ) # create a sequence self.test_sequence = Sequence( name="Test Sequence", code="SEQ1", project=self.test_project, status_list=self.test_sequence_status_list ) # create a shot self.test_shot1 = Shot( name="SH001", code="SH001", project=self.test_project, sequences=[self.test_sequence], status_list=self.test_shot_status_list, ) # create a group of Tasks for the shot self.test_task1 = Task(name="Task1", parent=self.test_shot1, status_list=self.test_task_status_list) # a Link for the input file self.test_input_link1 = Link( name="Input Link 1", full_path="/mnt/M/JOBs/TestProj/Seqs/TestSeq/Shots/SH001/FX/" "Outputs/SH001_beauty_v001.###.exr", ) self.test_input_link2 = Link( name="Input Link 2", full_path="/mnt/M/JOBs/TestProj/Seqs/TestSeq/Shots/SH001/FX/" "Outputs/SH001_occ_v001.###.exr", ) # a Link for the output file self.test_output_link1 = Link( name="Output Link 1", full_path="/mnt/M/JOBs/TestProj/Seqs/TestSeq/Shots/SH001/FX/" "Outputs/SH001_beauty_v001.###.exr", ) self.test_output_link2 = Link( name="Output Link 2", full_path="/mnt/M/JOBs/TestProj/Seqs/TestSeq/Shots/SH001/FX/" "Outputs/SH001_occ_v001.###.exr", ) # now create a version for the Task self.kwargs = { "take_name": "TestTake", "inputs": [self.test_input_link1, self.test_input_link2], "outputs": [self.test_output_link1, self.test_output_link2], "task": self.test_task1, "status_list": self.test_version_status_list, "created_with": "Houdini", } self.take_name_test_values = [ ("Take Name", "Take_Name"), ("TakeName", "TakeName"), ("take name", "take_name"), (" take_name", "take_name"), ("take_name ", "take_name"), (" take name ", "take_name"), ("TakeName", "TakeName"), ("Take___Name", "Take___Name"), ] # and the Version self.test_version = Version(**self.kwargs) # set the published to False self.test_version.is_published = False
def setUpClass(cls): """set up the test for class """ DBSession.remove()
def tearDownClass(cls): """cleanup the test in class level """ DBSession.remove() DBSession.configure()
task_from_db = Task.query.get(task_id) # now query the total_logged_seconds benchmark_start = time.time() total_logged_seconds = task_from_db.total_logged_seconds benchmark_end = time.time() print('total_logged_seconds: %s sec' % total_logged_seconds) print('old way worked in: %s sec' % (benchmark_end - benchmark_start)) # now use the new way of doing it benchmark_start = time.time() quick_total_logged_seconds = task_from_db.total_logged_seconds benchmark_end = time.time() print('quick_total_logged_seconds: %s sec' % quick_total_logged_seconds) print('new way worked in: %s sec' % (benchmark_end - benchmark_start)) assert total_logged_seconds == quick_total_logged_seconds # clean up test database DBSession.rollback() connection = DBSession.connection() engine = connection.engine connection.close() Base.metadata.drop_all(engine, checkfirst=True) DBSession.remove() stalker.defaults.timing_resolution = datetime.timedelta(hours=1) DBSession.close_all() drop_db(database_name)
def setUpClass(cls): """setup once """ # remove the transaction manager DBSession.remove() cls.repo_path = tempfile.mkdtemp() from anima import defaults defaults.local_storage_path = tempfile.mktemp() db.setup({ 'sqlalchemy.url': 'sqlite:///:memory:', 'sqlalchemy.echo': 'false' }) db.init() # create Power Users Group cls.power_users_group = Group(name='Power Users') DBSession.add(cls.power_users_group) DBSession.commit() # create a LocalSession first cls.admin = User.query.all()[0] cls.lsession = LocalSession() cls.lsession.store_user(cls.admin) cls.lsession.save() # create a repository cls.test_repo1 = Repository(name='Test Repository', windows_path='T:/TestRepo/', linux_path='/mnt/T/TestRepo/', osx_path='/Volumes/T/TestRepo/') cls.test_structure1 = Structure(name='Test Project Structure', templates=[], custom_template='') cls.status_new = Status.query.filter_by(code='NEW').first() cls.status_wip = Status.query.filter_by(code='WIP').first() cls.status_cmpl = Status.query.filter_by(code='CMPL').first() cls.project_status_list = \ StatusList.query.filter_by(target_entity_type=Project).first() # create a couple of projects cls.test_project1 = Project(name='Project 1', code='P1', repository=cls.test_repo1, structure=cls.test_structure1, status_list=cls.project_status_list) cls.test_project2 = Project(name='Project 2', code='P2', repository=cls.test_repo1, structure=cls.test_structure1, status_list=cls.project_status_list) cls.test_project3 = Project(name='Project 3', code='P3', repository=cls.test_repo1, structure=cls.test_structure1, status_list=cls.project_status_list) cls.projects = [ cls.test_project1, cls.test_project2, cls.test_project3 ] cls.test_user1 = User( name='Test User', # groups=[self.power_users_group], login='******', email='*****@*****.**', password='******') DBSession.add(cls.test_user1) DBSession.commit() cls.admin.projects.append(cls.test_project1) cls.admin.projects.append(cls.test_project2) cls.admin.projects.append(cls.test_project3) cls.test_user1.projects.append(cls.test_project1) cls.test_user1.projects.append(cls.test_project2) cls.test_user1.projects.append(cls.test_project3) # project 1 cls.test_task1 = Task( name='Test Task 1', project=cls.test_project1, resources=[cls.admin], ) cls.test_task2 = Task( name='Test Task 2', project=cls.test_project1, resources=[cls.admin], ) cls.test_task3 = Task( name='Test Task 2', project=cls.test_project1, resources=[cls.admin], ) # project 2 cls.test_task4 = Task( name='Test Task 4', project=cls.test_project2, resources=[cls.admin], ) cls.test_task5 = Task( name='Test Task 5', project=cls.test_project2, resources=[cls.admin], ) cls.test_task6 = Task( name='Test Task 6', parent=cls.test_task5, resources=[cls.admin], ) cls.test_task7 = Task( name='Test Task 7', parent=cls.test_task5, resources=[], ) cls.test_task8 = Task( name='Test Task 8', parent=cls.test_task5, resources=[], ) cls.test_task9 = Task( name='Test Task 9', parent=cls.test_task5, resources=[], ) # +-> Project 1 # | | # | +-> Task1 # | | # | +-> Task2 # | | # | +-> Task3 # | # +-> Project 2 # | | # | +-> Task4 # | | # | +-> Task5 # | | # | +-> Task6 # | | # | +-> Task7 (no resource) # | | # | +-> Task8 (no resource) # | | # | +-> Task9 (no resource) # | # +-> Project 3 # record them all to the db DBSession.add_all([ cls.admin, cls.test_project1, cls.test_project2, cls.test_project3, cls.test_task1, cls.test_task2, cls.test_task3, cls.test_task4, cls.test_task5, cls.test_task6, cls.test_task7, cls.test_task8, cls.test_task9 ]) DBSession.commit() cls.all_tasks = [ cls.test_task1, cls.test_task2, cls.test_task3, cls.test_task4, cls.test_task5, cls.test_task6, cls.test_task7, cls.test_task8, cls.test_task9 ] # create versions cls.test_version1 = Version(cls.test_task1, created_by=cls.admin, created_with='Test', description='Test Description') DBSession.add(cls.test_version1) DBSession.commit() cls.test_version2 = Version(cls.test_task1, created_by=cls.admin, created_with='Test', description='Test Description') DBSession.add(cls.test_version2) DBSession.commit() cls.test_version3 = Version(cls.test_task1, created_by=cls.admin, created_with='Test', description='Test Description') cls.test_version3.is_published = True DBSession.add(cls.test_version3) DBSession.commit() cls.test_version4 = Version(cls.test_task1, take_name='Main@GPU', created_by=cls.admin, created_with='Test', description='Test Description') cls.test_version4.is_published = True DBSession.add(cls.test_version4) DBSession.commit() if not QtGui.QApplication.instance(): logger.debug('creating a new QApplication') cls.app = QtGui.QApplication(sys.argv) else: logger.debug('using the present QApplication: %s' % QtGui.qApp) # self.app = QtGui.qApp cls.app = QtGui.QApplication.instance() # cls.test_environment = TestEnvironment() cls.dialog = version_dialog.MainDialog()
def tearDown(self): DBSession.remove() testing.tearDown()
def tearDown(self): """clean up the test """ DBSession.remove()
def setUp(self): """set up the test """ # create the db DBSession.remove() db.setup() # db.init() # we just need statuses so create them instead of initializing the db db.create_ticket_statuses() db.create_entity_statuses(entity_type='Task', status_names=defaults.task_status_names, status_codes=defaults.task_status_codes) db.create_entity_statuses(entity_type='Asset', status_names=defaults.task_status_names, status_codes=defaults.task_status_codes) db.create_entity_statuses(entity_type='Shot', status_names=defaults.task_status_names, status_codes=defaults.task_status_codes) db.create_entity_statuses(entity_type='Sequence', status_names=defaults.task_status_names, status_codes=defaults.task_status_codes) db.create_entity_statuses(entity_type='Review', status_names=defaults.review_status_names, status_codes=defaults.review_status_codes) # create statuses self.test_status1 = Status(name='N', code='N') self.test_status2 = Status(name='R', code='R') # get the ticket types ticket_types = Type.query \ .filter(Type.target_entity_type == 'Ticket').all() self.ticket_type_1 = ticket_types[0] self.ticket_type_2 = ticket_types[1] # create a User self.test_user = User(name='Test User', login='******', email='*****@*****.**', password='******') # create a Repository self.test_repo = Repository(name="Test Repo") # create a Project Type self.test_project_type = Type( name='Commercial Project', code='comm', target_entity_type=Project, ) # create a Project StatusList self.test_project_status1 = Status(name='PrjStat1', code='PrjStat1') self.test_project_status2 = Status(name='PrjStat2', code='PrjStat2') self.test_project_status_list = StatusList( name="Project Status List", target_entity_type=Project, statuses=[ self.test_project_status1, self.test_project_status2, ]) self.test_task_status_list = StatusList.query\ .filter_by(target_entity_type='Task').first() # create a Project self.test_project = Project(name="Test Project 1", code="TEST_PROJECT_1", type=self.test_project_type, repository=self.test_repo, status_list=self.test_project_status_list) # create an Asset self.test_asset_status_list = StatusList.query\ .filter_by(target_entity_type='Asset').first() self.test_asset_type = Type(name='Character Asset', code='char', target_entity_type=Asset) self.test_asset = Asset(name="Test Asset", code='ta', project=self.test_project, status_list=self.test_asset_status_list, type=self.test_asset_type) # create a Task self.test_task = Task(name="Modeling of Asset 1", resources=[self.test_user], status_list=self.test_task_status_list, parent=self.test_asset) # create a Version self.test_version_status_list = StatusList( name='Version Statuses', target_entity_type=Version, statuses=[self.test_status1, self.test_status2]) self.test_version = Version(name='Test Version', task=self.test_task, status_list=self.test_version_status_list, version=1, full_path='some/path') # create the Ticket self.kwargs = { 'project': self.test_project, 'links': [self.test_version], 'summary': 'This is a test ticket', 'description': 'This is the long description', 'priority': 'TRIVIAL', 'reported_by': self.test_user, } self.test_ticket = Ticket(**self.kwargs) DBSession.add(self.test_ticket) DBSession.commit() # get the Ticket Statuses self.status_new = Status.query.filter_by(name='New').first() self.status_accepted = Status.query.filter_by(name='Accepted').first() self.status_assigned = Status.query.filter_by(name='Assigned').first() self.status_reopened = Status.query.filter_by(name='Reopened').first() self.status_closed = Status.query.filter_by(name='Closed').first()
def tearDown(self): """tear down the test """ DBSession.remove()
def tearDownClass(cls): """clean up the test """ DBSession.remove()
def setUp(self): """set up the test """ # create the db DBSession.remove() db.setup() # db.init() # we just need statuses so create them instead of initializing the db db.create_ticket_statuses() db.create_entity_statuses(entity_type='Task', status_names=defaults.task_status_names, status_codes=defaults.task_status_codes) db.create_entity_statuses(entity_type='Asset', status_names=defaults.task_status_names, status_codes=defaults.task_status_codes) db.create_entity_statuses(entity_type='Shot', status_names=defaults.task_status_names, status_codes=defaults.task_status_codes) db.create_entity_statuses(entity_type='Sequence', status_names=defaults.task_status_names, status_codes=defaults.task_status_codes) db.create_entity_statuses(entity_type='Review', status_names=defaults.review_status_names, status_codes=defaults.review_status_codes) # create statuses self.test_status1 = Status(name='N', code='N') self.test_status2 = Status(name='R', code='R') # get the ticket types ticket_types = Type.query \ .filter(Type.target_entity_type == 'Ticket').all() self.ticket_type_1 = ticket_types[0] self.ticket_type_2 = ticket_types[1] # create a User self.test_user = User( name='Test User', login='******', email='*****@*****.**', password='******' ) # create a Repository self.test_repo = Repository(name="Test Repo") # create a Project Type self.test_project_type = Type( name='Commercial Project', code='comm', target_entity_type=Project, ) # create a Project StatusList self.test_project_status1 = Status(name='PrjStat1', code='PrjStat1') self.test_project_status2 = Status(name='PrjStat2', code='PrjStat2') self.test_project_status_list = StatusList( name="Project Status List", target_entity_type=Project, statuses=[ self.test_project_status1, self.test_project_status2, ] ) self.test_task_status_list = StatusList.query\ .filter_by(target_entity_type='Task').first() # create a Project self.test_project = Project( name="Test Project 1", code="TEST_PROJECT_1", type=self.test_project_type, repository=self.test_repo, status_list=self.test_project_status_list ) # create an Asset self.test_asset_status_list = StatusList.query\ .filter_by(target_entity_type='Asset').first() self.test_asset_type = Type( name='Character Asset', code='char', target_entity_type=Asset ) self.test_asset = Asset( name="Test Asset", code='ta', project=self.test_project, status_list=self.test_asset_status_list, type=self.test_asset_type ) # create a Task self.test_task = Task( name="Modeling of Asset 1", resources=[self.test_user], status_list=self.test_task_status_list, parent=self.test_asset ) # create a Version self.test_version_status_list = StatusList( name='Version Statuses', target_entity_type=Version, statuses=[self.test_status1, self.test_status2] ) self.test_version = Version( name='Test Version', task=self.test_task, status_list=self.test_version_status_list, version=1, full_path='some/path' ) # create the Ticket self.kwargs = { 'project': self.test_project, 'links': [self.test_version], 'summary': 'This is a test ticket', 'description': 'This is the long description', 'priority': 'TRIVIAL', 'reported_by': self.test_user, } self.test_ticket = Ticket(**self.kwargs) DBSession.add(self.test_ticket) DBSession.commit() # get the Ticket Statuses self.status_new = Status.query.filter_by(name='New').first() self.status_accepted = Status.query.filter_by(name='Accepted').first() self.status_assigned = Status.query.filter_by(name='Assigned').first() self.status_reopened = Status.query.filter_by(name='Reopened').first() self.status_closed = Status.query.filter_by(name='Closed').first()
# Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA from stalker import db, User from stalker.models.asset import Asset from stalker.models.project import Project from stalker.models.repository import Repository from stalker.db.session import DBSession from stalker.models.status import Status, StatusList from stalker.models.task import Task from stalker.models.type import Type DBSession.remove() DBSession.configure(extension=None) db.setup() status1 = Status(name="Complete", code="CMPLT") status2 = Status(name="Pending Review", code="PRev") repo1 = Repository(name="TestRepo") project_status_list = StatusList( name="test", target_entity_type=Project, statuses=[status1] ) project_type = Type(
def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ # use the ZopeTransactionExtension for session from zope.sqlalchemy import ZopeTransactionExtension from stalker.db.session import DBSession DBSession.remove() DBSession.configure(extension=ZopeTransactionExtension()) # setup the database to the given settings from stalker import db db.setup(settings) import os for key in os.environ: logger.debug('%s: %s' % (key, os.environ[key])) # setup internal and external urls global stalker_server_external_url global stalker_server_internal_url stalker_server_external_url = settings.get('stalker.external_url') stalker_server_internal_url = settings.get('stalker.internal_url') # setup authorization and authentication from pyramid.authentication import AuthTktAuthenticationPolicy from pyramid.authorization import ACLAuthorizationPolicy from stalker_pyramid.views.auth import group_finder authn_policy = AuthTktAuthenticationPolicy('sosecret', hashalg='sha512', callback=group_finder) authz_policy = ACLAuthorizationPolicy() from pyramid.config import Configurator config = Configurator( settings=settings, root_factory='stalker_pyramid.views.auth.RootFactory') config.set_authentication_policy(authn_policy) config.set_authorization_policy(authz_policy) # Configure Beaker sessions and caching import pyramid_beaker 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_jinja2_renderer('.html') config.add_jinja2_search_path('templates', name='.html') config.add_static_view('static', 'static', cache_max_age=3600) config.add_static_view('angular', 'angular', cache_max_age=3600) config.add_static_view('templates', 'templates', cache_max_age=3600) # ************************************************************************* # Basics config.add_route('home', '/') config.add_route('me_menu', 'me_menu') config.add_route('signin', 'signin') config.add_route('login', '/api/login') config.add_route('logout', '/api/logout') config.add_route('logged_in_user', '/api/logged_in_user') 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/\.]+}') # before anything about stalker create the defaults from stalker.config import defaults logger.debug( os.path.normpath(defaults.server_side_storage_path + '/{partial_file_path}').replace('\\', '/')) # ************************************************************************* # DATA VIEWS # ************************************************************************* # ************************************************************************* # SimpleEntities config.add_route('simple_entity', '/api/simple_entities/{id}') config.add_route('simple_entities', '/api/simple_entities') config.add_route('simple_entity_generic_data', '/api/simple_entities/{id}/generic_data') # ************************************************************************* # Entities config.add_route('entity', '/api/entities/{id}') config.add_route('entities', '/api/entities') config.add_route('entity_notes', '/api/entities/{id}/notes') config.add_route('entity_tags', '/api/entities/{id}/tags') # OLD VIEWS config.add_route('get_search_result', '/search') # json config.add_route('submit_search', '/submit_search') # TODO: Do we still really need "get_entity_tasks_by_filter" config.add_route('get_entity_tasks_by_filter', 'api/entities/{id}/tasks/filter/{f_id}/') config.add_route('get_entity_tickets', 'api/entities/{id}/tickets/') config.add_route('get_entity_tickets_count', 'api/entities/{id}/tickets/count/') config.add_route('get_entity_time_logs', 'api/entities/{id}/time_logs/') config.add_route('get_entity_projects', 'api/entities/{id}/projects/') config.add_route('get_entity_sequences', 'api/entities/{id}/sequences/') config.add_route('get_entity_sequences_count', 'api/entities/{id}/sequences/count/') config.add_route('get_entity_assets', 'api/entities/{id}/assets/') config.add_route('get_entity_assets_count', 'api/entities/{id}/assets/count/') config.add_route('get_entity_shots', 'api/entities/{id}/shots/') config.add_route('get_entity_shots_simple', 'api/entities/{id}/shots/simple/') config.add_route('get_entity_shots_count', 'api/entities/{id}/shots/count/') config.add_route('get_entity_scenes', 'api/entities/{id}/scenes/') config.add_route('get_entity_scenes_simple', 'api/entities/{id}/scenes/simple/') config.add_route('get_entity_scenes_count', 'api/entities/{id}/scenes/count/') config.add_route('get_entity_vacations', 'api/entities/{id}/vacations/') config.add_route('get_entity_vacations_count', 'api/entities/{id}/vacations/count/') config.add_route('get_entity_entities_out_stack', 'api/entities/{id}/{entities}/out_stack/') config.add_route('get_entity_events', 'api/entities/{id}/events/') #json config.add_route('get_entity_notes', 'api/entities/{id}/notes/') #json config.add_route('get_entity_task_min_start', 'api/entities/{id}/task_min_start/') #json config.add_route('get_entity_task_max_end', 'api/entities/{id}/task_max_end/') #json config.add_route('get_entity_users_roles', 'api/entities/{id}/users/roles/') #json config.add_route('append_entities_to_entity', 'api/entities/{id}/append') # ************************************************************************* # Notes config.add_route('note', '/api/notes/{id}') config.add_route('notes', '/api/notes') # ************************************************************************* # Thumbnail and Links config.add_route('link', '/api/links/{id}') config.add_route('links', '/api/links') # config.add_route('upload_files', 'api/upload_files') # config.add_route('assign_thumbnail', 'api/assign_thumbnail') # ************************************************************************* # References config.add_route('get_task_references', 'api/tasks/{id}/references/') # json config.add_route('get_task_references_count', 'api/tasks/{id}/references/count/') # json config.add_route('get_asset_references', 'api/assets/id}/references/') # json config.add_route('get_asset_references_count', 'api/assets/id}/references/count/') # json config.add_route('get_shot_references', 'api/shots/{id}/references/') # json config.add_route('get_shot_references_count', 'api/shots/{id}/references/count/') # json config.add_route('get_references', 'api/references/') config.add_route('get_reference', 'api/references/{id}') config.add_route('assign_reference', 'api/assign_reference') config.add_route('delete_reference', 'api/references/{id}/delete') config.add_route('update_reference', 'api/references/{id}/update') # ************************************************************************* # Outputs config.add_route('get_entity_outputs', 'api/entities/{id}/outputs/') config.add_route('get_entity_outputs_count', 'api/entities/{id}/outputs/count/') config.add_route('get_task_outputs', 'api/tasks/{id}/outputs/') config.add_route('get_task_outputs_count', 'api/tasks/{id}/outputs/count/') config.add_route('get_version_outputs', 'api/versions/{id}/outputs/') config.add_route('get_version_outputs_count', 'api/versions/{id}/outputs/count/') config.add_route('assign_output', 'api/assign_output') config.add_route('delete_output', 'api/outputs/{id}/delete') # ************************************************************************* # Studio config.add_route('create_studio', 'api/studios/create') config.add_route('update_studio', 'api/studios/{id}/update') config.add_route('get_studio_tasks', 'api/studios/{id}/tasks/') config.add_route('get_studio_vacations', 'api/studios/{id}/vacations/') # json config.add_route('get_studio_vacations_count', 'api/studios/{id}/vacations/count/') # json config.add_route('schedule_info', 'api/schedule_info') # json config.add_route('studio_scheduling_mode', 'api/studio_scheduling_mode') config.add_route('auto_schedule_tasks', 'api/auto_schedule_tasks') # ************************************************************************* # Project config.add_route('projects', '/api/projects') config.add_route('project', '/api/projects/{id}') config.add_route('project_budgets', '/api/projects/{id}/budgets') config.add_route('project_clients', '/api/projects/{id}/clients') config.add_route('project_dailies', '/api/projects/{id}/dailies') config.add_route('project_references', '/api/projects/{id}/references') config.add_route('project_repositories', '/api/projects/{id}/repositories') config.add_route('project_tasks', '/api/projects/{id}/tasks') config.add_route('project_tickets', '/api/projects/{id}/tickets') config.add_route('project_users', '/api/projects/{id}/users') # config.add_route('project_assets', '/api/projects/{id}/tasks?entity_type=Asset') # config.add_route('project_shots', '/api/projects/{id}/tasks?entity_type=Shot') # config.add_route('project_sequences', '/api/projects/{id}/tasks?entity_type=Sequence') # config.add_route('project_scenes', '/api/projects/{id}/tasks?entity_type=Scene') # config.add_route('project_reviews', 'api/projects/{id}/reviews/') #json # config.add_route('project_tasks_cost', 'api/projects/{id}/tasks/cost/') #json # config.add_route('add_project_entries_to_budget', 'api/projects/{id}/entries/budgets/{bid}/add') # config.add_route('get_project_tasks_today', 'api/projects/{id}/tasks/{action}/today/') # json # config.add_route('get_project_tasks_in_date', 'api/projects/{id}/tasks/{action}/{date}/') # json # ************************************************************************* # Clients config.add_route('append_user_to_client', 'api/clients/{id}/user/append') config.add_route('create_client', 'api/clients/create') config.add_route('update_client', 'api/clients/{id}/update') config.add_route('get_studio_clients', 'api/studios/{id}/clients/') config.add_route('get_clients', 'api/clients/') config.add_route('get_client_users_out_stack', 'api/clients/{id}/users/out_stack/') config.add_route('get_client_users', 'api/clients/{id}/users/') # ************************************************************************* # Budgets config.add_route('create_budget', 'api/budgets/create') config.add_route('update_budget', 'api/budgets/{id}/update') config.add_route('save_budget_calendar', 'api/budgets/{id}/save/calendar') config.add_route('duplicate_budget', 'api/budgets/{id}/duplicate') config.add_route('change_budget_type', 'api/budgets/{id}/type/{type_name}') config.add_route('get_budget_entries', 'api/budgets/{id}/entries/') # ************************************************************************* # BudgetEntries config.add_route('create_budgetentry', 'api/budgetentries/create') config.add_route('edit_budgetentry', 'api/budgetentries/edit') config.add_route('update_budgetentry', 'api/budgetentries/update') config.add_route('delete_budgetentry', 'api/budgetentries/delete') # ************************************************************************* # Dailies config.add_route('create_daily', 'api/dailies/create') config.add_route('update_daily', 'api/dailies/{id}/update') config.add_route('inline_update_daily', 'api/dailies/{id}/update/inline') config.add_route('get_daily_outputs', 'api/dailies/{id}/outputs/') # json config.add_route('append_link_to_daily', 'api/links/{id}/dailies/{did}/append') config.add_route('remove_link_to_daily', 'api/links/{id}/dailies/{did}/remove') config.add_route('convert_to_webm', 'api/links/{id}/convert_to_webm') # ************************************************************************* # ImageFormat config.add_route('image_format', '/api/image_formats/{id}') config.add_route('image_formats', '/api/image_formats') # ************************************************************************* # Repository config.add_route('repository', '/api/repositories/{id}') config.add_route('repositories', '/api/repositories') # serve files in repository config.add_route('serve_repository_files', '$REPO{id}/{partial_file_path:[a-zA-Z0-9/\._\-\+\(\)]*}') config.add_route('forced_download_repository_files', 'FD{file_path:[a-zA-Z0-9/\._\-\+\(\)/$]*}') config.add_route('video_player', 'video_player') # html # ************************************************************************* # Structure config.add_route('structure', '/api/structures/{id}') config.add_route('structures', '/api/structures') config.add_route('structure_templates', '/api/structures/{id}/templates') # ************************************************************************* # User config.add_route('users', '/api/users') config.add_route('user', '/api/users/{id}') config.add_route('user_departments', '/api/users/{id}/departments') config.add_route('user_groups', '/api/users/{id}/groups') config.add_route('user_projects', '/api/users/{id}/projects') config.add_route('user_vacations', '/api/users/{id}/vacations') config.add_route('user_tasks', '/api/users/{id}/tasks') config.add_route('user_tasks_watched', '/api/users/{id}/tasks_watched') config.add_route('user_tasks_responsible', '/api/users/{id}/tasks_responsible') config.add_route('user_reviews', '/api/users/{id}/reviews') config.add_route('user_tickets', '/api/users/{id}/tickets') config.add_route('user_time_logs', '/api/users/{id}/time_logs') # other views config.add_route('check_availability', '/api/check_availability') # ************************************************************************* # FilenameTemplate config.add_route('filename_template', '/api/filename_templates/{id}') config.add_route('filename_templates', '/api/filename_templates') # ************************************************************************* # Status config.add_route('status', '/api/statuses/{id}') config.add_route('statuses', '/api/statuses') # ************************************************************************* # StatusList # base views config.add_route('status_list', '/api/status_lists/{id}') config.add_route('status_lists', '/api/status_lists') # collection views config.add_route('status_list_statuses', '/api/status_lists/{id}/statuses') # ************************************************************************* # Assets config.add_route('create_asset', 'api/assets/create') config.add_route('update_asset', 'api/assets/{id}/update') config.add_route('get_asset_tickets', 'api/assets/{id}/tickets/') config.add_route('get_assets_types', 'api/assets/types/') # json config.add_route('get_assets_type_task_types', 'api/assets/types/{t_id}/task_types/') # json config.add_route('get_assets_children_task_type', 'api/assets/children/task_type/') # json # ************************************************************************* # Shots config.add_route('create_shot', 'api/shots/create') config.add_route('update_shot', 'api/shots/{id}/update') config.add_route('get_shots_children_task_type', 'api/shots/children/task_type/') # json # ************************************************************************* # Scene config.add_route('get_scenes_children_task_type', 'api/scenes/children/task_type/') # json config.add_route('create_scene', 'api/scenes/create') # html # ************************************************************************* # Sequence config.add_route('create_sequence', 'api/sequences/create') config.add_route('update_sequence', 'api/sequences/{id}/update') config.add_route('get_sequence_references', 'api/sequences/{id}/references/') # json config.add_route('get_sequence_references_count', 'api/sequences/{id}/references/count/') # json config.add_route('get_sequence_tickets', 'api/sequences/{id}/tickets/') # json config.add_route('get_sequence_tasks', 'api/sequences/{id}/tasks/') # json config.add_route('get_sequences', 'api/sequences/') # json # ************************************************************************* # Task config.add_route('get_task_external_link', 'api/tasks/{id}/external_link') config.add_route('get_task_internal_link', 'api/tasks/{id}/internal_link') # Actions config.add_route('create_task', 'api/tasks/create') config.add_route('update_task', 'api/tasks/{id}/update') config.add_route('inline_update_task', 'api/tasks/{id}/update/inline') config.add_route('update_task_schedule_timing', 'api/tasks/{id}/update/schedule_timing') config.add_route('update_task_dependencies', 'api/tasks/{id}/update/dependencies') config.add_route('force_task_status', 'api/tasks/{id}/force_status/{status_code}') config.add_route('force_tasks_status', 'api/tasks/force_status/{status_code}') config.add_route('resume_task', 'api/tasks/{id}/resume') config.add_route('review_task', 'api/tasks/{id}/review') config.add_route('cleanup_task_new_reviews', 'api/tasks/{id}/cleanup_new_reviews') config.add_route('duplicate_task_hierarchy', 'api/tasks/{id}/duplicate') config.add_route('get_gantt_tasks', 'api/tasks/{id}/gantt') config.add_route('get_gantt_task_children', 'api/tasks/{id}/children/gantt') config.add_route('get_tasks', 'api/tasks/') config.add_route('get_tasks_count', 'api/tasks/count/') config.add_route('get_task', 'api/tasks/{id}/') config.add_route('get_task_events', 'api/tasks/{id}/events/') #json config.add_route('get_task_children_task_types', 'api/tasks/{id}/children_task_types/') # json config.add_route('get_task_children_tasks', 'api/tasks/{id}/children_tasks/') # json config.add_route('get_task_leafs_in_hierarchy', 'api/tasks/{id}/leafs_in_hierarchy/') #json config.add_route('get_task_related_entities', 'api/tasks/{id}/related/{e_type}/{d_type}/') # json config.add_route('get_task_dependency', 'api/tasks/{id}/dependency/{type}/') # json config.add_route('get_task_tickets', 'api/tasks/{id}/tickets') # json config.add_route('get_task_reviews', 'api/tasks/{id}/reviews/') # json config.add_route('get_task_reviews_count', 'api/tasks/{id}/reviews/count/') # json config.add_route('get_task_reviewers', 'api/tasks/{id}/reviewers/') # json config.add_route('get_task_last_reviews', 'api/tasks/{id}/last_reviews/') #json config.add_route('request_review', 'api/tasks/{id}/request_review') config.add_route('approve_task', 'api/tasks/{id}/approve') config.add_route('request_revision', 'api/tasks/{id}/request_revision') config.add_route('request_revisions', 'api/tasks/request_revisions') config.add_route('request_extra_time', 'api/tasks/{id}/request_extra_time') config.add_route('get_task_resources', 'api/tasks/{id}/resources/') #json config.add_route('remove_task_user', 'api/tasks/{id}/remove/{user_type}/{user_id}') config.add_route('change_tasks_users', 'api/tasks/change/{user_type}') config.add_route('change_task_users', 'api/tasks/{id}/change/{user_type}') config.add_route('change_tasks_priority', 'api/tasks/change_priority') config.add_route('add_tasks_dependencies', 'api/tasks/add/dependencies') config.add_route('delete_task', 'api/tasks/delete') config.add_route('fix_tasks_statuses', 'api/tasks/fix/statuses/') config.add_route('fix_task_statuses', 'api/tasks/{id}/fix/statuses/') config.add_route('fix_task_schedule_info', 'api/tasks/{id}/fix/schedule_info/') config.add_route('watch_task', 'api/tasks/{id}/watch') config.add_route('unwatch_task', 'api/tasks/{id}/unwatch') # ************************************************************************* # TimeLog config.add_route('time_log', '/api/time_logs/{id}') config.add_route('time_logs', '/api/time_logs') # ************************************************************************* # Ticket config.add_route('ticket', '/api/tickets/{id}') config.add_route('tickets', '/api/tickets') config.add_route('ticket_links', '/api/tickets/{id}/links') config.add_route('ticket_related_tickets', '/api/tickets/{id}/related_tickets') config.add_route('ticket_logs', '/api/tickets/{id}/logs') # extra urls config.add_route('ticket_resolutions', '/api/ticket_resolutions') config.add_route('ticket_workflow', '/api/ticket_workflow') # ************************************************************************* # Vacation config.add_route('vacation', '/api/vacations/{id}') config.add_route('vacations', '/api/vacations') # ************************************************************************* # Version config.add_route('create_version', 'api/versions/create') config.add_route('get_task_versions', 'api/tasks/{id}/versions/') # jsons config.add_route('get_user_versions', 'api/users/{id}/versions/') # jsons config.add_route('get_entity_versions', 'api/entities/{id}/versions/') # json config.add_route('get_entity_versions_used_by_tasks', 'api/entities/{id}/version/used_by/tasks/') # json config.add_route('pack_version', 'api/versions/{id}/pack') # json # ************************************************************************* # Department config.add_route('department', '/api/departments/{id}') config.add_route('departments', '/api/departments') config.add_route('department_users', '/api/departments/{id}/users') config.add_route('department_user_roles', '/api/departments/{id}/user_roles') # old ones config.add_route('department_tasks', '/api/departments/{id}/tasks') # ************************************************************************* # Group config.add_route('group', '/api/groups/{id}') config.add_route('groups', '/api/groups') # collection views config.add_route('group_users', '/api/groups/{id}/users') # ************************************************************************* # Tag config.add_route('tag', 'api/tags/{id}') config.add_route('tags', 'api/tags') # ************************************************************************* # Type config.add_route('type', 'api/types/{id}') config.add_route('types', 'api/types') # ************************************************************************* # Role config.add_route('role', '/api/roles/{id}') config.add_route('roles', '/api/roles') # ************************************************************************* # Price Lists / Good config.add_route('get_studio_goods', 'api/studios/{id}/goods/') config.add_route('get_goods', 'api/goods/') config.add_route('get_studio_price_lists', 'api/studios/{id}/price_lists/') config.add_route('get_price_lists', 'api/price_lists/') config.add_route('create_good', 'api/goods/create') config.add_route('edit_good', 'api/goods/edit') config.add_route('update_good', 'api/goods/update') config.add_route('delete_good', 'api/goods/delete') # ************************************************************************* # Anima config.add_route('add_related_assets', 'api/entities/{id}/assets/add') config.add_route('remove_related_asset', 'api/entities/{id}/assets/{a_id}/remove') config.add_route('get_entity_task_type_result', 'api/entities/{id}/{task_type}/result') # ************************************************************************* # Test config.add_route('test_page', 'test_page') config.scan(ignore='stalker.env') return config.make_wsgi_app()
def tearDown(self): """clean the test """ DBSession.remove()