zoom.collect module¶
zoom.collect
-
class
zoom.collect.BasicSearch(collection)¶ Bases:
zoom.collect.RawSearchProvides basic unindexed field aware search capability
-
search(text)¶ Return records that match search text
-
-
class
zoom.collect.Collection(fields, **kwargs)¶ Bases:
objectA collection of Records
-
allows(user, action)¶ Policy rules for shared collection
-
controller¶ alias of
CollectionController
-
fields¶ a fields callable may have data intensive operations, delay execution until it is needed
-
get_columns()¶ Return the collection columns.
-
get_labels()¶ Return the collection labels.
-
handle(route, request)¶ handle a request
-
has_many_records¶
-
locate(key)¶ locate a record
-
order(item)¶ Returns the sort key
-
process(*args, **data)¶ Process method parameters
This style of calling collections is useful when you want to make your collection available as an attribute of a Dispatcher.
-
search(text)¶ Seach the collection for records matching text
-
set_fields(fields)¶ Set the fields to a new value
This can be used for switching fields on the fly, for example when your collection contains entities that are similar enough to be included in the same collection, but that require their own fields.
-
sorter= None¶
-
store= None¶
-
store_type¶ alias of
zoom.store.EntityStore
-
url= None¶
-
verbose= True¶
-
view¶ alias of
CollectionView
-
-
class
zoom.collect.CollectionController(collection)¶ Bases:
zoom.mvc.ControllerPerform operations on a Collection
-
add_image(*_, **kwargs)¶ accept uploaded images and attach them to the record
-
after_delete(record)¶ Things to do after deleting a record
-
after_insert(record)¶ Things to do after inserting a record
-
after_update(record)¶ Things to do after updating a record
-
before_delete(record)¶ Things to do before deleting a record
-
before_insert(record)¶ Things to do before inserting a record
-
before_update(record)¶ Things to do before updating a record
Create a record
-
delete(key, confirm='yes')¶ Delete a record
-
delete_image(key, name)¶ Delete an image field
-
reindex(**kwargs)¶ checks authorization and calls function if authorized
-
remove_image(*_, **kwargs)¶ remove a dropzone image
Save a record
-
-
class
zoom.collect.CollectionModel¶ Bases:
zoom.models.Model-
allows(user, action)¶ Item level policy
-
link¶ Return a link
-
url¶ Return a valid URL
-
-
zoom.collect.CollectionRecord¶ alias of
zoom.collect.CollectionModel
-
class
zoom.collect.CollectionStore(store)¶ Bases:
objectDecorate a Store
Provide additional features to a Store class to make it work with collections.
-
class
zoom.collect.CollectionView(collection)¶ Bases:
zoom.mvc.ViewView a collection
-
clear()¶ Clear the search
-
delete(key, confirm='yes')¶ Show a delete form for a collection record
-
edit(key, **data)¶ Display an edit form for a record
-
get_image(*a, **k)¶ return one of the images from an ImagesField value
-
image(key, name)¶ Respond with image field contents
-
index(q='', *args, **kwargs)¶ collection landing page
-
list_images(key=None, value=None)¶ return list of images for an ImagesField value for this record
-
new(*args, **kwargs)¶ Return a New Item form
-
show(key)¶ Show a record
-
-
class
zoom.collect.IndexedCollectionSearch(collection)¶ Bases:
objectProvides token index for fast lookups
We only provide enough room for tokens up to length 20 only because we have to draw the line somewhere. This may result in some records not being found if the search would have mached on characters beyond the position 20.
-
add(key, values)¶ Add record values to index
-
delete(key)¶ Delete indexed record values
-
max_token_len= 20¶
-
reindex()¶ Rebuild the collection index
This method indexes a few records at a time, in batches. It can be very slow so should be done only by admins or as part of a maintenance cycle in the background. Once the table is indexed this routine should not be needed. It’s mainly provided to index an already existing table or to replace a damaged index.
-
search(text)¶ Return records that match search text
-
update(key, values)¶ Update indexed record values
-
zap()¶ Delete values for all records
-
-
class
zoom.collect.RawSearch(collection)¶ Bases:
objectRaw Data Search
-
add(key, values)¶ Add record values to index
-
delete(key)¶ Delete indexed record values
-
reindex()¶
-
search(text)¶ Return records that match raw search text
-
update(key, values)¶ Update indexed record values
-
-
class
zoom.collect.SilentCollection(fields, **kwargs)¶ Bases:
zoom.collect.CollectionA collection of Records where we do not audit “View” events
-
verbose= False¶
-
-
zoom.collect.as_tokens(values, max_len=20)¶ Return values as a set of tokens
>>> sorted(list(as_tokens(['this is a test', 'other', 'tokentoolongtobecapturedasis']))) ['a', 'is', 'other', 'test', 'this', 'tokentoolongtobecapt']
-
zoom.collect.image_response(name, data)¶ provide an image response based on the file extension
-
zoom.collect.locate(collection, key)¶ locate a record
Authourization policy for a shared collection