def get_item(self, name):
     return Item(self, name)
Ejemplo n.º 2
0
 def create_item(self, itemname):
     if not isinstance(itemname, (str, unicode)):
         raise TypeError("Item names must have string type, not %s" % (type(itemname)))
     elif self.has_item(itemname):
         raise ItemAlreadyExistsError("An Item with the name %r already exists!" % (itemname))
     return Item(self, itemname)
Ejemplo n.º 3
0
 def iteritems(self):
     filenames = os.listdir(self._path)
     for filename in filenames:
         yield Item(self, self._unquote(filename))
Ejemplo n.º 4
0
 def get_item(self, itemname):
     if not self._exists(itemname):
         raise NoSuchItemError("No such item, %r" % (itemname))
     return Item(self, itemname)