Exemplo n.º 1
0
    def __getitem__(self, key):
        if key in self:
            # Key is an episode, return it
            return dict.__getitem__(self, key)

        if key in self.data:
            # Non-numeric request is for show-data
            return dict.__getitem__(self.data, key)

        # Data wasn't found, raise appropriate error
        if isinstance(key, int) or key.isdigit():
            # Episode number x was not found
            raise tvdb_seasonnotfound("Could not find season %s" % (repr(key)))
        else:
            # If it's not numeric, it must be an attribute name, which
            # doesn't exist, so attribute error.
            raise tvdb_attributenotfound("Cannot find attribute %s" % (repr(key)))
Exemplo n.º 2
0
    def __getitem__(self, key):
        if key in self:
            # Key is an episode, return it
            return dict.__getitem__(self, key)

        if key in self.data:
            # Non-numeric request is for show-data
            return dict.__getitem__(self.data, key)

        # Data wasn't found, raise appropriate error
        if isinstance(key, int) or key.isdigit():
            # Episode number x was not found
            raise tvdb_seasonnotfound("Could not find season %s" % (repr(key)))
        else:
            # If it's not numeric, it must be an attribute name, which
            # doesn't exist, so attribute error.
            raise tvdb_attributenotfound("Cannot find attribute %s" %
                                         (repr(key)))
Exemplo n.º 3
0
 def __getitem__(self, key):
     try:
         return dict.__getitem__(self, key)
     except KeyError:
         raise tvdb_attributenotfound("Cannot find attribute %s" % (repr(key)))
Exemplo n.º 4
0
 def __getitem__(self, key):
     try:
         return dict.__getitem__(self, key)
     except KeyError:
         raise tvdb_attributenotfound('Cannot find attribute %s' %
                                      (repr(key)))