Logo Search packages:      
Sourcecode: zeroinstall-injector version File versions

def zeroinstall::injector::iface_cache::IfaceCache::download_key (   self,
  interface,
  key_id 
)

Download a GPG key.
The location of the key is calculated from the uri of the interface.
@param interface: the interface which needs the key
@param key_id: the GPG long id of the key
@todo: This method blocks. It should start a download and return.
@deprecated: see PendingFeed

Definition at line 222 of file iface_cache.py.

00222                                                :
            """Download a GPG key.
            The location of the key is calculated from the uri of the interface.
            @param interface: the interface which needs the key
            @param key_id: the GPG long id of the key
            @todo: This method blocks. It should start a download and return.
            @deprecated: see PendingFeed
            """
            assert interface
            assert key_id
            import urlparse, urllib2, shutil, tempfile
            key_url = urlparse.urljoin(interface.uri, '%s.gpg' % key_id)
            info("Fetching key from %s", key_url)
            try:
                  stream = urllib2.urlopen(key_url)
                  # Python2.4: can't call fileno() on stream, so save to tmp file instead
                  tmpfile = tempfile.TemporaryFile(prefix = 'injector-dl-data-')
                  shutil.copyfileobj(stream, tmpfile)
                  tmpfile.flush()
                  stream.close()
            except Exception, ex:
                  raise SafeException("Failed to download key from '%s': %s" % (key_url, str(ex)))

            import gpg

            tmpfile.seek(0)
            gpg.import_key(tmpfile)
            tmpfile.close()

      def update_interface_from_network(self, interface, new_xml, modified_time):


Generated by  Doxygen 1.6.0   Back to index