This file is indexed.

/usr/share/pyshared/Pyblosxom/cache/entryshelve.py is in pyblosxom 1.5.3-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
#######################################################################
# This file is part of Pyblosxom.
#
# Copyright (C) 2003-2011 by the Pyblosxom team.  See AUTHORS.
#
# Pyblosxom is distributed under the MIT license.  See the file
# LICENSE for distribution details.
#######################################################################

"""
This cache driver creates shelved data as cache in a dbm file.

To use this driver, add the following configuration options in your config.py

py['cacheDriver'] = 'entryshelve'
py['cacheConfig'] = '/path/to/a/cache/dbm/file'

If successful, you will see the cache file. Be sure that you have write access
to the cache file.
"""

from Pyblosxom.cache.base import BlosxomCacheBase
import shelve
import os

class BlosxomCache(BlosxomCacheBase):
    """
    This stores entries in shelves in a .dbm file.
    """
    def __init__(self, req, config):
        """
        Initializes BlosxomCacheBase.__init__ and also opens the
        shelf file.
        """
        BlosxomCacheBase.__init__(self, req, config)
        self._db = shelve.open(self._config)

    def load(self, entryid):
        """
        Loads a specific entryid.
        """
        BlosxomCacheBase.load(self, entryid)

    def getEntry(self):
        """
        Get an entry from the shelf.
        """
        data = self._db.get(self._entryid, {})
        return data.get('entrydata', {})

    def isCached(self):
        """
        Returns true if the entry is cached and the cached version is
        not stale.  Returns false otherwise.
        """
        data = self._db.get(self._entryid, {'mtime':0})
        if os.path.isfile(self._entryid):
            return data['mtime'] == os.stat(self._entryid)[8]
        else:
            return None


    def saveEntry(self, entrydata):
        """
        Save data in the pickled file.
        """
        payload = {}
        payload['mtime'] = os.stat(self._entryid)[8]
        payload['entrydata'] = entrydata

        self._db[self._entryid] = payload


    def rmEntry(self):
        """
        Removes an entry from the shelf.
        """
        if self._db.has_key(self._entryid):
            del self._db[self._entryid]

    def keys(self):
        """
        Returns a list of entries that are cached in the shelf.

        @returns: list of entry paths
        @rtype: list of strings
        """
        ret = []
        for key in self._db.keys():
            self.load(key)
            if self.isCached():
                ret.append(key)
            else:
                # Remove this key, why is it there in the first place?
                del self._db[self._entryid]
        return ret


    def close(self):
        """
        Closes the db file.
        """
        self._db.close()
        self._db = None