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

def zeroinstall::injector::policy::Policy::get_interface (   self,
  uri 
)

Get an interface from the L{iface_cache}. If it is missing or needs updating,
start a new download.
@rtype: L{model.Interface}

Definition at line 396 of file policy.py.

00396                                   :
            """Get an interface from the L{iface_cache}. If it is missing or needs updating,
            start a new download.
            @rtype: L{model.Interface}"""
            iface = iface_cache.get_interface(uri)

            if uri in iface_cache.pending:
                  # Don't start another download while one is pending
                  # TODO: unless the pending version is very old
                  return iface

            if iface.last_modified is None:
                  if self.network_use != network_offline:
                        debug("Interface not cached and not off-line. Downloading...")
                        self.begin_iface_download(iface)
                  else:
                        if self._warned_offline:
                              debug("Nothing known about interface, but we are off-line.")
                        else:
                              if iface.feeds:
                                    info("Nothing known about interface '%s' and off-line. Trying feeds only.", uri)
                              else:
                                    warn("Nothing known about interface '%s', but we are in off-line mode "
                                          "(so not fetching).", uri)
                                    self._warned_offline = True
            elif not uri.startswith('/'):
                  staleness = time.time() - (iface.last_checked or 0)
                  debug("Staleness for %s is %.2f hours", iface, staleness / 3600.0)

                  if self.network_use != network_offline and self.freshness > 0 and staleness > self.freshness:
                        debug("Updating %s", iface)
                        self.begin_iface_download(iface, False)
            #else: debug("Local interface, so not checking staleness.")

            return iface
      
      def begin_iface_download(self, interface, force = False):


Generated by  Doxygen 1.6.0   Back to index