Skip to content

Commit

Permalink
Bumped to v1.2.5!
Browse files Browse the repository at this point in the history
  • Loading branch information
toastdriven committed Sep 14, 2011
1 parent 0347829 commit f716e7a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
# The short X.Y version.
version = '1.2'
# The full version, including alpha/beta/rc tags.
release = '1.2.5-beta'
release = '1.2.5'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
34 changes: 17 additions & 17 deletions haystack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


__author__ = 'Daniel Lindsley'
__version__ = (1, 2, 5, 'beta')
__version__ = (1, 2, 5)
__all__ = ['backend']


Expand All @@ -32,25 +32,25 @@
def load_backend(backend_name=None):
"""
Loads a backend for interacting with the search engine.
Optionally accepts a ``backend_name``. If provided, it should be a string
of one of the following (built-in) options::
* solr
* xapian
* whoosh
* simple
* dummy
If you've implemented a custom backend, you can provide the "short" portion
of the name (before the ``_backend``) and Haystack will attempt to load
that backend instead.
If not provided, the ``HAYSTACK_SEARCH_ENGINE`` setting is used.
"""
if not backend_name:
backend_name = settings.HAYSTACK_SEARCH_ENGINE

try:
# Most of the time, the search backend will be one of the
# backends that ships with haystack, so look there first.
Expand All @@ -67,8 +67,8 @@ def load_backend(backend_name=None):
available_backends = [
os.path.splitext(f)[0].split("_backend")[0] for f in os.listdir(backend_dir)
if f != "base.py"
and not f.startswith('_')
and not f.startswith('.')
and not f.startswith('_')
and not f.startswith('.')
and not f.endswith('.pyc')
and not f.endswith('.pyo')
]
Expand All @@ -86,18 +86,18 @@ def load_backend(backend_name=None):
def autodiscover():
"""
Automatically build the site index.
Again, almost exactly as django.contrib.admin does things, for consistency.
"""
import imp
from django.conf import settings

for app in settings.INSTALLED_APPS:
# For each app, we need to look for an search_indexes.py inside that app's
# package. We can't use os.path here -- recall that modules may be
# imported different ways (think zip files) -- so we need to get
# the app's __path__ and look for search_indexes.py on that path.

# Step 1: find out the app's __path__ Import errors here will (and
# should) bubble up, but a missing __path__ (which is legal, but weird)
# fails silently -- apps that do weird things with __path__ might
Expand All @@ -106,7 +106,7 @@ def autodiscover():
app_path = importlib.import_module(app).__path__
except AttributeError:
continue

# Step 2: use imp.find_module to find the app's search_indexes.py. For some
# reason imp.find_module raises ImportError if the app can't be found
# but doesn't actually try to import the module. So skip this app if
Expand All @@ -115,7 +115,7 @@ def autodiscover():
imp.find_module('search_indexes', app_path)
except ImportError:
continue

# Step 3: import the app's search_index file. If this has errors we want them
# to bubble up.
importlib.import_module("%s.search_indexes" % app)
Expand All @@ -125,7 +125,7 @@ def handle_registrations(*args, **kwargs):
"""
Ensures that any configuration of the SearchSite(s) are handled when
importing Haystack.
This makes it possible for scripts/management commands that affect models
but know nothing of Haystack to keep the index up to date.
"""
Expand All @@ -135,17 +135,17 @@ def handle_registrations(*args, **kwargs):
# apps generate import errors and requires extra work on the user's
# part to make things work.
return

# This is a little dirty but we need to run the code that follows only
# once, no matter how many times the main Haystack module is imported.
# We'll look through the stack to see if we appear anywhere and simply
# return if we do, allowing the original call to finish.
stack = inspect.stack()

for stack_info in stack[1:]:
if 'handle_registrations' in stack_info[3]:
return

# Pull in the config file, causing any SearchSite initialization code to
# execute.
search_sites_conf = importlib.import_module(settings.HAYSTACK_SITECONF)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name='django-haystack',
version='1.2.5-beta',
version='1.2.5',
description='Pluggable search for Django.',
author='Daniel Lindsley',
author_email='[email protected]',
Expand Down

0 comments on commit f716e7a

Please sign in to comment.