This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description


The provides searching functionality for the Horae resource planning system by implementing a ajax driven full text search and a pluggable advanced search form. Additionally it implements a restricted special Query implementation based on the one provided by hurry.query which only returns results the user is allowed to see.


There are several ways to extend and adjust the behaviour of the search forms and results by registering special adapters. The following possibilities are available for any views sub-classing from

Extending the advanced search form

The advanced search form may be extended by registering a named multi adapter implementing and adapting the context and request. If for example one would like to add a new TextLine field searching in a custom catalog the implementation would look something like this:

import grok

from zope import interface
from zope import schema
from zope.publisher.interfaces.browser import IBrowserRequest

from hurry import query

from import interfaces

class SampleAdvancedSearchFieldProvider(grok.MultiAdapter):
    grok.adapts(interface.Interface, IBrowserRequest)

    def __init__(self, context, request):
        self.context = context
        self.request = request

    def fields(self):
        """ Returns a list of fields to be added to the form
        return [
                __name__ = 'sample_text_line',
                title = u'Sample text line'

    def query(self, **data):
        """ Returns a list of queries
        queries = []
        if 'sample_text_line' in data:
            queries.append(query.Text(('samplecatalog', 'text'),
        return queries

Adjusting default sorting

By default the search results are sorted by a special integer index in the catalog. This integer may be adjusted by registering a named adapter implementing and adapting the object the sorting should be changed for. If for example one would like to move every ticket having a special property set to the bottom of the search results the implementation would look like this:

from horae.ticketing.interfaces import ITicket

class SampleSortingProvider(grok.Adapter):

    def add(self):
        """ Returns an integer to be added to the sorting
        return 0

    def adjust(self, sorting):
        """ Adjusts the sorting after all providers sorting
            where added and returns the adjusted sorting
        if (self.context.get_property('my_special_property', None) is not None):
            return 0
        return sorting

Changing default sorting

As mentioned above the default sorting of the search results is a special integer index in the catalog. This may be changed by registering an adapter implementing and adapting either the search view or the search view and the desired context. An example implementation changing the default sorting of the advanced search results would look like this:

from import search

class SampleDefaultSortingProvider(grok.Adapter):

    def sort_field(self):
        """ The index used to sort
        return ('samplecatalog', 'sorting')

    def reverse(self):
        """ Whether to reverse the sort order
        return False

Adding columns

Adding new columns to the results table is possible by registering a named adapter implementing adapting the desired context. The following is an example implementation found in providing a column showing whether an object has been completed or not:

class CompleteColumnProvider(grok.Adapter):
    """ Column provider adding the complete column

    name = 'complete'
    title = _(u'Completed')
    sortable = None
    insert_after = '*'

    def __init__(self, context):
        self.context = context

    def filterable(self):
        """ Returns a vocabulary for filtering the column or
            None if no filtering is available
        return vocabulary.SimpleVocabulary([
            vocabulary.SimpleTerm(0, 'no', _p(u'No')),
            vocabulary.SimpleTerm(1, 'yes', _p(u'Yes'))

    def factory(self, object, request):
        """ Returns the value to be displayed for the given object
        return (IComplete(object, lambda: False)() and _p(u'Yes') or _p(u'No'))

    def cache_key(self, key, *args, **kwargs):
        """ Modifies the cache key if needed and returns it
        return key + parents_modification_cache_key(self.context)

Adding row CSS class

Last but not least one may add custom CSS classes to the rows by registering a named adapter implementing adapting the desired context. An example implementation adding a CSS class special if a ticket has a special property set would look like this:

class SampleRowClassProvider(grok.Adapter):

    def classes(self):
        """ Returns a list of CSS classes to be set on the row
        if (self.context.get_property('my_special_property', None) is not None):
            return ['special']
        return []


1.0a1 (2012-01-16)

  • Initial release
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date (18.3 kB) Copy SHA256 Checksum SHA256 Source Jan 16, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting