- -
-

pyams_catalog package

- -
-

Submodules

-
-
-

pyams_catalog.include module

-
-
-pyams_catalog.include.include_package(config)
-

Pyramid include

-
- -
-
-

pyams_catalog.index module

-
-
-class pyams_catalog.index.DatetimeIndexWithInterface(interface, discriminator, resolution=2, family=None)
-

Bases: pyams_catalog.index.FieldIndexWithInterface

-

Normalized datetime index with interface support

-
-
-discriminate(obj, default)
-
- -
- -
-
-class pyams_catalog.index.FacetIndexWithInterface(interface, discriminator, facets, family=None)
-

Bases: pyams_catalog.index.InterfaceSupportIndexMixin, hypatia.facet.FacetIndex

-

Facet index with interface support

-
- -
-
-class pyams_catalog.index.FieldIndexWithInterface(interface, discriminator, family=None)
-

Bases: pyams_catalog.index.InterfaceSupportIndexMixin, hypatia.field.FieldIndex

-

Field index with interface support

-
- -
-
-class pyams_catalog.index.InterfaceSupportIndexMixin(interface)
-

Bases: hypatia.util.BaseIndexMixin

-

Custom index mixin handling objects interfaces

-
-
-discriminate(obj, default)
-

See interface IIndexInjection

-
- -
- -
-
-class pyams_catalog.index.KeywordIndexWithInterface(interface, discriminator, family=None)
-

Bases: pyams_catalog.index.InterfaceSupportIndexMixin, hypatia.keyword.KeywordIndex

-

Keyword index with interface support

-
- -
-
-class pyams_catalog.index.TextIndexWithInterface(interface, discriminator, lexicon=None, language='english', index=None, family=None)
-

Bases: pyams_catalog.index.InterfaceSupportIndexMixin, hypatia.text.TextIndex

-

Text index with interface support

-
- -
-
-pyams_catalog.index.get_resolution(value, resolution)
-

Set resolution of given date or datetime

-
>>> from pyams_catalog.interfaces import *
->>> from pyams_catalog.index import get_resolution
->>> from datetime import date, datetime
-
-
-

Starting with dates:

-
>>> today = date(2017, 7, 11)
->>> get_resolution(today, YEAR_RESOLUTION)
-datetime.date(2017, 1, 1)
->>> get_resolution(today, MONTH_RESOLUTION)
-datetime.date(2017, 7, 1)
->>> get_resolution(today, DATE_RESOLUTION)
-datetime.date(2017, 7, 11)
-
-
-

Asking for a resolution higher than DATE with a date input only returns date:

-
>>> get_resolution(today, MINUTE_RESOLUTION)
-datetime.date(2017, 7, 11)
-
-
-

Same examples with datetimes:

-
>>> now = datetime(2017, 7, 11, 13, 22, 10)
->>> get_resolution(now, YEAR_RESOLUTION)
-datetime.datetime(2017, 1, 1, 0, 0)
->>> get_resolution(now, MONTH_RESOLUTION)
-datetime.datetime(2017, 7, 1, 0, 0)
->>> get_resolution(now, DATE_RESOLUTION)
-datetime.datetime(2017, 7, 11, 0, 0)
->>> get_resolution(now, HOUR_RESOLUTION)
-datetime.datetime(2017, 7, 11, 13, 0)
->>> get_resolution(now, MINUTE_RESOLUTION)
-datetime.datetime(2017, 7, 11, 13, 22)
->>> get_resolution(now, SECOND_RESOLUTION)
-datetime.datetime(2017, 7, 11, 13, 22, 10)
-
-
-
- -
-
-

pyams_catalog.nltk module

-
-
-class pyams_catalog.nltk.NltkFullTextProcessor(language='english')
-

Bases: object

-

NLTK based full text processor

-
-
-process(lst)
-
- -
-
-processGlob(lst)
-
- -
- -
-
-class pyams_catalog.nltk.NltkStemmedTextProcessor(language='english')
-

Bases: object

-

NLTK based text processor using stemmer

-
-
-process(lst)
-
- -
-
-processGlob(lst)
-
- -
- -
-
-

pyams_catalog.query module

-
-
-class pyams_catalog.query.CatalogResultSet(query)
-

Bases: object

-

Catalog query result set wrapper

-
-
-append(items)
-
- -
-
-prepend(items)
-
- -
- -
-
-pyams_catalog.query.and_(source, added)
-

Combine two queries with ‘and’

-
- -
-
-pyams_catalog.query.or_(source, added)
-

Combine two queries with ‘or’

-
- -
-
-

pyams_catalog.site module

-
-
-class pyams_catalog.site.CatalogGenerationsChecker
-

Bases: object

-

Catalog generations checker

-
-
-evolve(site, current=None)
-

Check for required utilities

-
- -
-
-generation = 1
-
- -
- -
-
-pyams_catalog.site.check_required_indexes(site, indexes, catalog_name='')
-

Utility function to check for required catalog indexes

-

utilities argument is a tuple made of: -- the index name -- the index class -- index factory arguments

-
- -
-
-pyams_catalog.site.handle_modified_object(event)
-

Update catalog for modified object

-
- -
-
-pyams_catalog.site.handle_new_local_site(event)
-

Create a new catalog when a site is created

-
- -
-
-pyams_catalog.site.handle_new_object(event)
-

Index new persistent object

-
- -
-
-pyams_catalog.site.handle_removed_object(event)
-

Un-index removed object

-

Don’t use IObjectRemovedEvent to avoid objects from being already unregistered -from IIntId utility!!!

-
- -
-
-

pyams_catalog.utils module

-
-
-pyams_catalog.utils.catalog_key_adapter(obj)
-

Catalog key value adapter

-
- -
-
-pyams_catalog.utils.index_object(obj, catalog='', ignore_notyet=False)
-

Index given object into catalog

-
- -
-
-pyams_catalog.utils.reindex_object(obj, catalog='')
-

Reindex given object into catalog

-
- -
-
-pyams_catalog.utils.unindex_object(obj, catalog='')
-

Unindex given object from catalog

-
- -
-
-

Module contents

-
-
-pyams_catalog.includeme(config)
-

Pyramid include

-
- -
-
- - -