|
From: Blake W. <bl...@ph...> - 2003-02-04 16:54:05
|
> Responding to some comments from Wari, Our Glorious Leader: > > I need an API for storage. > > Okay, here's a first pass at the storage api. > ----------------->8 storageApi.py 8<-------------------- > """ > This module defines the api that any class implementing storage must > conform to. > """ > class Storage: > > # Storage types. > COMMENT = 1 > TRACKBACK = 2 > PINGBACK = 3 > SENT_TRACKBACK = 4 > SENT_PINGBACK = 5 > > def allFilter( entry ): > return true > > def get( self, type, entryId, filter=allFilter ): > # Returns a list of all the data for that entry, > # filtered by the filter. > pass > > def store( self, type, entryId, data ): > # Stores a bit of data of the specified type for the > # passed-in entry. > pass > > def search( self, searchTerm, type=None, entryId=None ): > # Searches in the specified type and entry (if supplied) > # for data containing the passed-in search term. > pass > ----------------->8 storageApi.py 8<-------------------- And some day I'll remember to not hold down the Control key when I hit enter. Anyways, what I wanted to say was: 1) Does this fulfill all of our needs in terms of storing and retrieving comments/trackbacks/pingbacks/etc? 2) Is it easy enough to use, or can it be made easier? 3) Is it reasonable to implement, or nigh impossible? I think most of the trickyness would come in writing filters. Oh, and there's currently no simple way to sort the data, but if we returned the bit of data as a tuple containing the type, and whatever else we could parse out, then a sorter would be fairly simple to write. Any and all comments appreciated. Later, Blake. |