Search Results

Search found 2 results on 1 pages for 'organicpanda'.

Page 1/1 | 1 

  • How do you access config outside of a request in CherryPy?

    - by OrganicPanda
    I've got a webapp running on CherryPy that needs to access the CherryPy config files before a user creates a request. The docs say to use: host = cherrypy.request.app.config['database']['host'] But that won't work outside of a user request. You can also use the application object when you start the app like so: ... application = cherrypy.tree.mount(root, '/', app_conf) host = application.config['database']['host'] ... But I can see no way of accessing 'application' from other classes outside of a user request. I ask because our app looks at several databases and we set them up when the app starts rather than on user request. I have a feeling this would be useful in other places too; so is there any way to store a reference to 'application' somewhere or access it through the CherryPy API?

    Read the article

  • Clear sqlalchemy reflection cache

    - by OrganicPanda
    Hi all, I'm using sqlalchemy's reflection tools to get a Table object. I do this because these tables are dynamic and tables/columns can change. Here's the code I'm using: def getTableByReflection(self, tableName, metadata, engine): return Table(tableName, metadata, autoload = True, autoload_with = engine) The problem is that when the above code is run twice it seems to return the same results regardless of whether or not the columns have changed. I have tried refreshing using the mysession.refresh(mytable) but that fails because the table is not attached to any metadata - which makes sense but then why am I seeing cached results? Is there any way to tell the metadata/engine/session to forget about this table and let me load it cleanly?

    Read the article

1