def view(request): session = DBSession() query = session.query(User) search_pattern = request.params.get("main_search", "") if search_pattern != "": query = query.filter(User.id.like("%s%%" % search_pattern)) return {'users': query.all(), 'search_pattern': search_pattern}
def main(argv=sys.argv): if len(argv) < 2: usage(argv) # create extra dirs for pth in ("data", "data/sessions", "../see_repo"): if not os.path.exists(pth): os.mkdir(pth) # remove sqlite file sqlite_pth = "data/seeweb.sqlite" if os.path.exists(sqlite_pth): os.remove(sqlite_pth) # clean data for obj_type in ("ro", "team", "user"): for name in glob("seeweb/data/avatar/%s/*.png" % obj_type): try: os.remove(name) except OSError: print "unable to remove %s" % name for name in glob("seeweb/data/gallery/*/"): try: rmtree(name) except OSError: print "unable to remove %s" % name for name in glob("../see_repo/*/"): try: rmtree(name) except OSError: print "unable to remove %s" % name # setup config config_uri = argv[1] options = parse_vars(argv[2:]) setup_logging(config_uri) settings = get_appsettings(config_uri, options=options) engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) Base.metadata.create_all(engine) # populate database with transaction.manager: session = DBSession() init_users.main(session) init_sample.main(session) pjt_auth_managment.main(session, users[0], containers[0]) pjt_data.main(session, users[0], containers[0]) pjt_workflow.main(session, users[0], containers[0])
def view(request): session = DBSession() query = session.query(ResearchObject) search_pattern = request.params.get("main_search", "") if search_pattern != "": query = query.filter(ResearchObject.name.like("%s%%" % search_pattern)) return {'ros': query.all(), 'search_pattern': search_pattern, 'links': session.query(ROLink).all()}
def view(request): session = DBSession() query = session.query(Team) search_pattern = request.params.get("main_search", "") if search_pattern != "": query = query.filter(Team.id.like("%s%%" % search_pattern)) query = query.order_by(Team.id) teams = query.all() return {'teams': teams, 'search_pattern': search_pattern}
def view(request): session = DBSession() # gather data src = request.params["source"] tgt = request.params["target"] link_type = request.params["link_type"] # test ownership # TODO # find link query = session.query(ROLink) query = query.filter(ROLink.source == src) query = query.filter(ROLink.target == tgt) query = query.filter(ROLink.type == link_type) link, = query.all() ROLink.remove(session, link) return True