Exemplo n.º 1
0
 def _make_resource(cls, folder, name, *args, **kw):
     Table._make_resource(cls, folder, name)
     # Import CSV with list of countries
     zones = []
     table = BaseCountries()
     csv = ro_database.get_handler(get_abspath('data/countries.csv'), CSVFile)
     for line in csv.get_rows():
         country = unicode(line[0], 'utf-8')
         zone = unicode(line[1], 'utf-8')
         if zone not in zones:
             zones.append(zone)
         table.add_record({'title': Property(country, language='fr'),
                           'zone': str(zones.index(zone)),
                           'enabled': True})
     folder.set_handler(name, table)
Exemplo n.º 2
0
 def _make_resource(cls, folder, name, *args, **kw):
     Table._make_resource(cls, folder, name)
     # Import CSV with list of countries
     zones = []
     table = BaseCountries()
     csv = ro_database.get_handler(get_abspath('data/countries.csv'),
                                   CSVFile)
     for line in csv.get_rows():
         country = unicode(line[0], 'utf-8')
         zone = unicode(line[1], 'utf-8')
         if zone not in zones:
             zones.append(zone)
         table.add_record({
             'title': Property(country, language='fr'),
             'zone': str(zones.index(zone)),
             'enabled': True
         })
     folder.set_handler(name, table)
Exemplo n.º 3
0
 def get_metadata_schema(cls):
     return merge_dicts(Table.get_metadata_schema(), criterium=FilterRange_Enumerate, unit=Unicode)
Exemplo n.º 4
0
 def get_metadata_schema(cls):
     return merge_dicts(Table.get_metadata_schema(),
                        criterium=FilterRange_Enumerate,
                        unit=Unicode)