Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Member Functions
MoinMoin.datastruct.backends.wiki_dicts.WikiDict Class Reference
Inheritance diagram for MoinMoin.datastruct.backends.wiki_dicts.WikiDict:
Inheritance graph
Collaboration diagram for MoinMoin.datastruct.backends.wiki_dicts.WikiDict:
Collaboration graph

List of all members.

Public Member Functions

def __iter__
def keys
def __len__
def __getitem__
def get
def __repr__

Public Attributes


Private Member Functions

def _load_dict

Detailed Description

Mapping of keys to values in a wiki page.

A dict definition page should look like:

   any text ignored
    key1:: value1
    * ignored, too
    key2:: value2 containing spaces
    keyn:: ....
   any text ignored

Definition at line 19 of file

Member Function Documentation

def MoinMoin.datastruct.backends.BaseDict.__getitem__ (   self,
) [inherited]

Definition at line 284 of file

00285     def __getitem__(self, key):
00286         return self._dict[key]

Here is the caller graph for this function:

Definition at line 275 of file

00276     def __iter__(self):
00277         return self._dict.__iter__()

Definition at line 281 of file

00282     def __len__(self):
00283         return self._dict.__len__()

Definition at line 301 of file

00302     def __repr__(self):
00303         return "<%r name=%r items=%r>" % (self.__class__,, self._dict.items())

Retrieve dict data from the backend.

Reimplemented from MoinMoin.datastruct.backends.BaseDict.

Definition at line 34 of file

00035     def _load_dict(self):
00036         request = self.request
00037         dict_name =
00039         page = Page(request, dict_name)
00040         if page.exists():
00041             arena = 'pagedicts'
00042             key = wikiutil.quoteWikinameFS(dict_name)
00043             cache = caching.CacheEntry(request, arena, key, scope='wiki', use_pickle=True)
00044             try:
00045                 cache_mtime = cache.mtime()
00046                 page_mtime = wikiutil.version2timestamp(page.mtime_usecs())
00047                 # TODO: fix up-to-date check mtime granularity problems.
00048                 #
00049                 # cache_mtime is float while page_mtime is integer
00050                 # The comparision needs to be done on the lowest type of both
00051                 if int(cache_mtime) > int(page_mtime):
00052                     # cache is uptodate
00053                     return cache.content()
00054                 else:
00055                     raise caching.CacheError
00056             except caching.CacheError:
00057                 # either cache does not exist, is erroneous or not uptodate: recreate it
00058                 d = super(WikiDict, self)._load_dict()
00059                 cache.update(d)
00060                 return d
00061         else:
00062             raise DictDoesNotExistError(dict_name)

def MoinMoin.datastruct.backends.BaseDict.get (   self,
  default = None 
) [inherited]
Return the value if key is in the dictionary, else default. If
default is not given, it defaults to None, so that this method
never raises a KeyError.

Definition at line 287 of file

00288     def get(self, key, default=None):
00289         """
00290         Return the value if key is in the dictionary, else default. If
00291         default is not given, it defaults to None, so that this method
00292         never raises a KeyError.
00293         """
00294         return self._dict.get(key, default)

Here is the caller graph for this function:

def MoinMoin.datastruct.backends.BaseDict.keys (   self) [inherited]

Definition at line 278 of file

00279     def keys(self):
00280         return list(self)

Here is the caller graph for this function:

Member Data Documentation

Definition at line 271 of file

Definition at line 270 of file

The documentation for this class was generated from the following file: