Ejemplo n.º 1
0
 def iterattrs(self):
     from aiida.backends.djsite.db.models import DbAttribute
     # TODO: check what happens if someone stores the object while
     #        the iterator is being used!
     if self._to_be_stored:
         for k, v in self._attrs_cache.iteritems():
             yield (k, v)
     else:
         all_attrs = DbAttribute.get_all_values_for_node(self.dbnode)
         for attr in all_attrs:
             yield (attr, all_attrs[attr])
Ejemplo n.º 2
0
    def _db_iterattrs(self):
        from aiida.backends.djsite.db.models import DbAttribute

        all_attrs = DbAttribute.get_all_values_for_node(self.dbnode)
        for attr in all_attrs:
            yield (attr, all_attrs[attr])