Package Pyblosxom :: Package entries :: Module fileentry :: Class FileEntry
[show private | hide private]
[frames | no frames]

Class FileEntry

EntryBase --+
            |
           FileEntry


This class gets it's data and metadata from the file specified by the filename argument.
Method Summary
  __init__(self, request, filename, root, datadir)
  __repr__(self)
Returns a friendly debuggable representation of self.
string getData(self)
Returns the data for this file entry.
string getId(self)
Returns the id for this content item--in this case, it's the filename.
varies getMetadata(self, key, default)
This overrides the base.EntryBase getMetadata method.
  setTimeLazy(self, timetuple)
Set the time without populating the entry.
    Inherited from EntryBase
varies __getitem__(self, key, default)
Retrieves an item from this dict based on the key given.
  __setitem__(self, key, value)
Sets the metadata[key] to the given value.
  addToCache(self, id, data)
Over-writes the cached dict for key id with the data dict.
varies get(self, key, default)
Retrieves an item from the internal dict based on the key given.
dict or None getFromCache(self, id)
Retrieves information from the cache that pertains to this specific id.
list of strings getMetadataKeys(self)
Returns the list of keys for which we have values in our stored metadata.
boolean has_key(self, key)
Returns whether a given key is in the metadata dict.
list of varies keys(self)
Returns a list of the keys that can be accessed through __getitem__.
  setData(self, data)
Sets the data content for this entry.
  setMetadata(self, key, value)
Sets a key/value pair in the metadata dict.
  setTime(self, timeTuple)
This takes in a given time tuple and sets all the magic metadata variables we have according to the items in the time tuple.
  update(self, newdict)
Updates the contents in this entry with the contents in the dict.

Method Details

__init__(self, request, filename, root, datadir='')
(Constructor)

Parameters:
request - the Request object
           (type=Request)
filename - the complete filename for the file in question including path
           (type=string)
root - i have no clue what this is
           (type=string)
datadir - the datadir
           (type=string)
Overrides:
Pyblosxom.entries.base.EntryBase.__init__

__repr__(self)
(Representation operator)

Returns a friendly debuggable representation of self. Useful to know on what entry pyblosxom fails on you (though unlikely)

returns: Identifiable representation of object rtype: string
Overrides:
Pyblosxom.entries.base.EntryBase.__repr__ (inherited documentation)

getData(self)

Returns the data for this file entry. The data is the parsed (via the entryparser) content of the entry. We do this on-demand by checking to see if we've gotten it and if we haven't then we get it at that point.
Returns:
the content for this entry
           (type=string)
Overrides:
Pyblosxom.entries.base.EntryBase.getData

getId(self)

Returns the id for this content item--in this case, it's the filename.
Returns:
the id of the fileentry (the filename)
           (type=string)
Overrides:
Pyblosxom.entries.base.EntryBase.getId

getMetadata(self, key, default=None)

This overrides the base.EntryBase getMetadata method.

Note: We populate our metadata lazily--only when it's requested. This delays parsing of the file as long as we can.
Parameters:
key - the key being sought
           (type=varies)
default - the default to return if the key does not exist
           (type=varies)
Returns:
either the default (if the key did not exist) or the value of the key in the metadata dict
           (type=varies)
Overrides:
Pyblosxom.entries.base.EntryBase.getMetadata

setTimeLazy(self, timetuple)

Set the time without populating the entry.
Parameters:
timetuple - the mtime of the file (same as returned by time.localtime(...))
           (type=tuple of 9 ints)

Generated by Epydoc 2.1 on Tue Feb 7 21:43:58 2006 http://epydoc.sf.net