class repository: """Implements a wftk repository. Define a repository using either a wftk.xml object or a string indicating a filename to read XML from.""" |
def __init__ (self, defn='system.defn'): """Create and optionally open repository object.""" self.repos = None if defn: if type(defn) == type(''): # string = filename self.repos = repmgr.open_file (defn) elif defn.__class__ == xml: self.repos = defn._xml repmgr.open (self.repos) |
_lists
, which is the list of lists defined in the repository.
There are two ways of querying a list; the first is the "list" method, which returns a list object, which
can be used to iterate around in the results. It corresponds roughly to a Recordset object in Microsoft's
DAO schema. The second way of querying a list is the "keys" method, which simply returns a Python list
of keys of entries. This list can be used to retrieve entries as required.
# -------------------------------------------------------------- # List manipulation. # -------------------------------------------------------------- def list (self, list='_lists', query=None, order=None): if self.repos==None: return [] return repmgr.list (self.repos, list) def keys (self, list='_lists', query=None, order=None): if self.repos==None: return [] return repmgr.list (self.repos, list) def defn (self, list='_lists'): if self.repos==None: return None x = repmgr.defn (self.repos, list) if not x: return None ret = xml() ret._xml = x return ret #def create #def drop #def define |
None
.
# -------------------------------------------------------------- # Entry manipulation. # -------------------------------------------------------------- def get (self, list, key): ret = entry(self, list, key) ret.load () if ret.is_element(): return ret return None def add (self, list, xml): ret = entry(self, list) ret.parse (xml) ret.save() return ret #def mod def delete (self, list, key): return repmgr.delete (self.repos, list, key) #def merge #def getkey #def form #def edit #def display #def getvalue #def setvalue # -------------------------------------------------------------- # Publishing # -------------------------------------------------------------- #def publish_all #def publish_list #def publish_obj #def publish_pages #def publish_page #def get_layout # -------------------------------------------------------------- # Change management. # -------------------------------------------------------------- #def changes #def snapshot #def push #def push_all #def pull #def pull_all #def synch #def attach (self,: #def retrieve # -------------------------------------------------------------- # Etc. # -------------------------------------------------------------- def user_auth (self, user, password): if self.repos==None: return return repmgr.user_auth (self.repos, user, password) |
This code and documentation are released under the terms of the GNU license. They are additionally copyright (c) 2001, Vivtek. All rights reserved except those explicitly granted under the terms of the GNU license. |