[Cubicweb] Access 'data_url' in postcreate.py

St├ęphane Bugat stephane.bugat at free.fr
Fri Aug 24 13:25:43 CEST 2012


Dear all,

I'd like to populate my database in 'migration/postcreate.py' by injecting some data issued from a CSV file located in the data/ subdir of the sources. Unfortunately, it seems that the convenient function 'data_url' that is usually accessible in hooks or views (via self._cw) does not exists here (I've scanned with an awful dir() the content of cnx, session and so on).

Is there another way to get it back? For the moment I use an ugly workaround using 'os.path.dirname(os.path.abspath(__file__))'...

Same question but this time in another context: self._cw.data_url is not available in Hooks with events like 'server_startup'...

Thanks a lot

Stephane



More information about the Cubicweb mailing list