Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    horae.autocomplete 1.0 Alpha 1

    Download button

    No screenshots available
    Downloads: 91  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Simon Kaeser | More programs
    GPL / FREE
    January 20th, 2012, 09:35 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    horae.autocomplete description

    Provides autocomplete fields and widgets for zope.formlib

    horae.autocomplete is a Python module that provides autocomplete fields and widgets for zope.formlib based on the autocomplete widget of jQuery UI.

    Usage

    There are two types of autocomplete fields available:

    AutocompleteList
     Allows selection of multiple values
    AutocompleteChoice
     Allows selection of one value

    To enable autocompletion for a list or choice field simply replace the List respectively the Choice from zope.schema by the one provided in horae.autocomplete.fields:

    from zope import interface, schema

    from horae.autocomplete import fields

    class ISampleSchema(interface.Interface):
     """ A schema using an autocomplete choice and list field
     """

     choice = fields.AutocompleteChoice(
     values = (u'one', u'two', u'three',)
     )

     list = fields.AutocompleteList(
     value_type = schema.Choice(
     values=(u'Tag 1', u'Tag 2', u'Tag 3',)
     )
     )


    The AutocompleteChoice field takes exactly the same parameters as the Choice field provided by zope.schema. The same is true for the AutocompleteList field which takes the same parameters as the List field of zope.schema with the only restriction that the value_type has to be either a Choice or TextLine field.

    Advanced usage

    Value providers

    The available values presented to the user when entering a term into the field are provided by adapters implementing horae.autocomplete.interfaces.IValueProvider. There are default value providers already implemented which look up the available values based on the given input in the vocabulary of the field. This is done by iterating over the values in the vocabulary and check whether a value matches the given input. For very large or infinite vocabularies this is quite expensive or not possible at all. To efficiently support such vocabularies value providers may be overridden by registering a more specific adapter implementing horae.autocomplete.interfaces.IValueProvider. Those adapters are looked up in the following order where the first one found is used:

    Named contextual provider
     A value provider adapting the context, field and request registered with the same name as the field
    Named uncontextual provider
     A value provider adapting the field and request registered with the same name as the field
    Contextual provider
     A value provider adapting the context, field and request
    Uncontextual provider
     A value provider adapting the field and request

    Examples of custom value providers is found in the horae.search package which provides non iterable vocabularies and corresponding value providers which use full text search in a catalog to look up the available values based on the input.

    Field providers

    As mentioned in the previous chapter the value providers are adapters adapting at least the field and the request. To look up those providers the field needs to be looked up first. In most cases this is not an issue at all since the fields are defined by the schema of the form. But in some cases the field is placed in the form only when rendering it which would then require to render the whole form only to find the required field. To efficiently support this use-case the way how a field is looked up may be overridden by registering an adapter implementing horae.autocomplete.interfaces.IFieldProvider and adapting the context and request.


    Product's homepage

    Requirements:

    · Python
    · Fanstatic
    · zope.fanstatic
    · js.jquery
    · js.jqueryui

      


    TAGS:

    autocomplete fields | zope.formlib widgets | autocomplete | fields | zope.formlib

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM