| Home | Trees | Indices | Help |
|---|
|
|
object --+
|
BaseDocsLoader
Baseclass for all doc loaders. Subclass this and override `get_docs` to implement a custom loading mechanism. You can then sync docs and design docs to the db with the `sync` function.
A very basic example for a loader that looks up a json file on the filesystem could look like this:
from couchdbkit import BaseDocsLoader
import os
import anyjson
class MyDocsLoader(BaseDocsLoader):
def __init__(self, path):
self.path = path
def get_docs(self,):
if not os.path.exists(path):
raise DocsPathNotFound
with file(path) as f:
source = anyjson.deserialize(f.read().decode('utf-8'))
return source
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
|
Inherited from |
|||
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Wed May 19 15:52:50 2010 | http://epydoc.sourceforge.net |