예제 #1
0
 def test_get_read_collection_path(self):
     path = get_read_collection_path(get_collection_class(IMyEntity),
                                     CsvMime, directory=self._data_dir)
     self.assert_false(path is None)
     tmp_dir = tempfile.mkdtemp()
     tmp_path = get_read_collection_path(get_collection_class(IMyEntity),
                                         CsvMime, directory=tmp_dir)
     self.assert_true(tmp_path is None)
예제 #2
0
 def test_get_read_collection_path(self):
     path = get_read_collection_path(get_collection_class(IMyEntity),
                                     CsvMime,
                                     directory=self._data_dir)
     self.assert_false(path is None)
     tmp_dir = tempfile.mkdtemp()
     tmp_path = get_read_collection_path(get_collection_class(IMyEntity),
                                         CsvMime,
                                         directory=tmp_dir)
     self.assert_true(tmp_path is None)
예제 #3
0
 def __load_entities(self, entity_class):
     coll_cls = get_collection_class(entity_class)
     fn = get_read_collection_path(coll_cls,
                                   self._config['content_type'],
                                   directory=self._config['directory'])
     if not fn is None:
         url = 'file://%s' % fn
         coll = load_collection_from_url(
             coll_cls, url, content_type=self._config['content_type'])
         ents = [mb.get_entity() for mb in coll]
     else:
         ents = []
     return ents
예제 #4
0
 def __load_entities(self, entity_class):
     coll_cls = get_collection_class(entity_class)
     fn = get_read_collection_path(coll_cls, self._config['content_type'],
                                   directory=self._config['directory'])
     if not fn is None:
         url = 'file://%s' % fn
         coll = load_collection_from_url(coll_cls, url,
                                         content_type=
                                             self._config['content_type'])
         ents = [mb.get_entity() for mb in coll]
     else:
         ents = []
     return ents