This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

Introduction

openc.excludesearch is designed to make it possible for an administrator to easily mark content as being hidden to searches.

NB: Requires dm’s AdvancedQuery from http://www.dieter.handshake.de/pyprojects/zope/#AdvancedQuery

First off, install myself:

>>> self.addProduct("openc.excludesearch")

We set up an object that will show in searches for “foo”:

>>> self.folder.invokeFactory('Document', 'foo', 'Foo Page')
'foo'
>>> self.folder['foo']
<ATDocument at .../foo>
>>> self.folder['foo'].setText("I am a foo object from foosville.")

We name it foo for convenience:

>>> foo = self.folder['foo']

We can see its text fine:

>>> foo.getText()
'<p>I am a foo object from foosville.</p>'
>>> foo.reindexObject()

If we search for it, we find it:

>>> app.plone.restrictedTraverse("queryCatalog")({"SearchableText":"foo"})
[<Products.ZCatalog.Catalog.mybrains object at ...>]

Once we activate the hiding functionality we don’t:

>>> foo.getField('hidesearch').get(foo)
False
>>> foo.getField('hidesearch').set(foo, value=True)
>>> foo.reindexObject()
>>> foo.getField('hidesearch').get(foo)
True
>>> app.plone.restrictedTraverse("queryCatalog")({"SearchableText":"foo"})
[]

This is because it has a new marker interface:

>>> from openc.excludesearch.interfaces import IExcludeFromSearch
>>> IExcludeFromSearch(foo)
<ATDocument at .../foo>

If we remove this marker, we find it again:

>>> foo.getField('hidesearch').get(foo)
True
>>> foo.getField('hidesearch').set(foo, value=False)
>>> foo.reindexObject()
>>> foo.getField('hidesearch').get(foo)
False
>>> app.plone.restrictedTraverse("queryCatalog")({"SearchableText":"foo"})
[<Products.ZCatalog.Catalog.mybrains object at ...>]

As we no longer provide that interface:

>>> IExcludeFromSearch(foo)
Traceback (most recent call last):
...
TypeError: ('Could not adapt', <ATDocument at .../foo>, <InterfaceClass openc.excludesearch.interfaces.IExcludeFromSearch>)

Todo

  1. Subclass/monkeypatch collections so they know to ignore things with the IExcludeFromSearch marker interface

Changelog

0.1 - Unreleased

  • Doctest [MatthewWilkes]
  • Added an adapter for archetypes.schemaextended to add a boolean field to the settings schema of any AT content type that adds/removes the marker interface when used. [MatthewWilkes]
  • Customised the queryCatalog script in a skin layer to drop all results providing IExludeFromSearch using AdvancedQuery [MatthewWilkes]
  • Added a marker interface called IExcludeFromSearch [MatthewWilkes]
Release History

Release History

0.1.1

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

0.1

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

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
openc.excludesearch-0.1.1.tar.gz (11.8 kB) Copy SHA256 Checksum SHA256 Source May 2, 2008

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS 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