~mvo/software-center/fix-lp920741

« back to all changes in this revision

Viewing changes to softwarecenter/db/database.py

  • Committer: Michael Vogt
  • Date: 2012-05-22 14:36:03 UTC
  • mfrom: (3022.1.10 fix-986563)
  • Revision ID: michael.vogt@ubuntu.com-20120522143603-h99d7xfw9j5z5zoh
mergedĀ lp:~nataliabidart/software-center/fix-986563

Show diffs side-by-side

added added

removed removed

Lines of Context:
493
493
        return popcon
494
494
 
495
495
    def get_xapian_document(self, appname, pkgname):
496
 
        """ Get the machting xapian document for appname, pkgname
497
 
 
498
 
        If no document is found, raise a IndexError
 
496
        """Get the machting xapian document for appname, pkgname.
 
497
 
 
498
        If no document is found, raise a IndexError.
 
499
 
499
500
        """
500
501
        #LOG.debug("get_xapian_document app='%s' pkg='%s'" % (appname,
501
502
        #    pkgname))
517
518
        raise IndexError("No app '%s' for '%s' in database" % (appname,
518
519
            pkgname))
519
520
 
 
521
    def is_pkgname_known(self, pkgname):
 
522
        """Check if 'pkgname' is known to this database.
 
523
 
 
524
        Note that even if this function returns True, it may mean that the
 
525
        package needs  to be purchased first or is available in a
 
526
        not-yet-enabled source.
 
527
 
 
528
        """
 
529
        # check cache first, then our own database
 
530
        return (pkgname in self._aptcache or
 
531
                any(self.xapiandb.postlist("AP" + pkgname)))
 
532
 
520
533
    def is_appname_duplicated(self, appname):
521
 
        """Check if the given appname is stored multiple times in the db
522
 
           This can happen for generic names like "Terminal"
 
534
        """Check if the given appname is stored multiple times in the db.
 
535
 
 
536
        This can happen for generic names like "Terminal".
 
537
 
523
538
        """
524
539
        for (i, m) in enumerate(self.xapiandb.postlist("AA" + appname)):
525
540
            if i > 0: