Beispiel #1
0
class SetManager(base.Manager):
    """
    Accessor for querying Sets.

    Access via the ``sets`` property of a :py:class:`koordinates.client.Client` instance.
    """

    _URL_KEY = "SET"

    def __init__(self, client):
        super(SetManager, self).__init__(client)
        # Inner model managers
        self._metadata = MetadataManager(self, client)

    def create(self, set):
        """
        Creates a new Set.
        """
        target_url = self.client.get_url("SET", "POST", "create")
        r = self.client.request("POST", target_url, json=set._serialize())
        return set._deserialize(r.json(), self)

    def set_metadata(self, set_id, fp):
        """
        Set the XML metadata on a set.

        :param file fp: file-like object to read the XML metadata from.
        """
        base_url = self.client.get_url("SET", "GET", "single", {"id": set_id})
        self._metadata.set(base_url, fp)
Beispiel #2
0
class SetManager(base.Manager):
    """
    Accessor for querying Sets.

    Access via the ``sets`` property of a :py:class:`koordinates.client.Client` instance.
    """

    _URL_KEY = 'SET'

    def __init__(self, client):
        super(SetManager, self).__init__(client)
        # Inner model managers
        self._metadata = MetadataManager(self, client)

    def create(self, set):
        """
        Creates a new Set.
        """
        target_url = self.client.get_url('SET', 'POST', 'create')
        r = self.client.request('POST', target_url, json=set._serialize())
        return set._deserialize(r.json(), self)

    def set_metadata(self, set_id, fp):
        """
        Set the XML metadata on a set.

        :param file fp: file-like object to read the XML metadata from.
        """
        base_url = self.client.get_url('SET', 'GET', 'single', {'id': set_id})
        self._metadata.set(base_url, fp)
Beispiel #3
0
 def __init__(self, client):
     super(SetManager, self).__init__(client)
     # Inner model managers
     self._metadata = MetadataManager(self, client)
Beispiel #4
0
 def __init__(self, client):
     super(SetManager, self).__init__(client)
     # Inner model managers
     self._metadata = MetadataManager(self, client)