[Cubicweb] Access 'data_url' in postcreate.py

Nicolas Chauvat nicolas.chauvat at logilab.fr
Mon Aug 27 11:23:29 CEST 2012

Hi St├ęphane,

On Mon, Aug 27, 2012 at 09:18:58AM +0200, St├ęphane Bugat wrote:

> 1- I need to have a "repository" containing the list of know
> airports in the world (a csv file), and also a list of known
> countries / territories. These static information will be updated
> very rarely, for instance once a year. Such information should be
> available to migration/postcreate.py to create the corresponding
> entries in the cw database.  ==> Shall I put such csv files in a
> subdir of migration/ for instance?

Sure, you can do that.

> 2- I have developed a certain number of "crawlers" that are able to
> retrieve airports informations (number of runways, nearby services
> and so on) from the web. I prefer to store these informations in
> static files, one file per airport, so they are available to me even
> when not connected to the net. The crawlers are called for the
> moment manually, but I intend to add a functionality available to
> 'managers' of the website to update these through the interface, so
> they will be used very often.  ==> What should be the preferred
> place to put those static files?

IMHO, ideally, you would use these crawlers to make new CWSource(s)...

I disagree that the fact that you need to have data when offline means
that you have to store this information in static files. You can store
this information in the database and have a very simple view (maybe
csvexport is enough) that allows you to get file(s) that you store on
you laptop.

Hence I would recommend CWSource-s + a view (csvexport) + a bash
script that does something like "wget baseurl/Airport?vid=csvexport"

> I saw that the tutorial for building a photo gallery recommends the
> creation of the specific byte file-system storage for image
> storage... Shall I adapt it to store those text informations?

Put it in the db instead and put maps and satellite views of the
airports in the file-system-storage.

Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  

More information about the Cubicweb mailing list