예제 #1
0
파일: countries.py 프로젝트: hforge/shop
 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)
예제 #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)
예제 #3
0
 def get_metadata_schema(cls):
     return merge_dicts(Table.get_metadata_schema(), criterium=FilterRange_Enumerate, unit=Unicode)
예제 #4
0
 def get_metadata_schema(cls):
     return merge_dicts(Table.get_metadata_schema(),
                        criterium=FilterRange_Enumerate,
                        unit=Unicode)