~bkerensa/ubuntu/saucy/moin/1.9.5-5

« back to all changes in this revision

Viewing changes to MoinMoin/search/queryparser.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-07-24 23:50:51 UTC
  • Revision ID: james.westby@ubuntu.com-20080724235051-qzjvwmfslyahnjnx
Tags: 1.7.1-1
* New upstream release.  Closes: bug#492233, thanks to Teodor.
  + Fixes bogus empty page creation.  Closes: bug#489146, thanks to
    Sam Morris.
* Recommend python-xml, needed for RSS feeds.  Closes: bug#488777,
  thanks to Sam Morris.
* Add patch 10001 to disable RenderAsDocbook if python-xml is not
  available. Closes: bug#487741, thanks to Franklin Piat.
* Update cdbs snippets:
  + Move dependency cleanup to new local snippet package-relations.mk.
  + Update copyright-check output to more closely match proposed new
    copyright file format.
  + Update README.cdbs-tweaks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
730
730
        """
731
731
        kwargs['use_re'] = True
732
732
        TextSearch._build_re(self,
733
 
                r'(?m)(^-----*\r?\n)(^##.*\r?\n)*^(?!##)(.*)\b%s\b' % pattern, **kwargs)
 
733
                r'(?m)(^-----*\s*\r?\n)(^##.*\r?\n)*^(?!##)(.*)\b%s\b' % pattern, **kwargs)
734
734
 
735
735
    def costs(self):
736
736
        return 5000 # cheaper than a TextSearch
960
960
                            # doing a "MatchAll AND_NOT someterm" for that case!
961
961
                            orexpr = OrExpression(terms)
962
962
                        terms = AndExpression(orexpr)
 
963
                    else:
 
964
                        raise ValueError('Nothing to OR')
963
965
                    remaining = self._analyse_items(items)
964
966
                    if remaining.__class__ == OrExpression:
965
967
                        for sub in remaining.subterms():
994
996
                domain = False
995
997
                while len(item) > 1:
996
998
                    m = item[0]
997
 
                    if m == M:
 
999
                    if m is None:
 
1000
                        raise ValueError("Invalid search prefix")
 
1001
                    elif m == M:
998
1002
                        negate = True
999
1003
                    elif "title".startswith(m):
1000
1004
                        title_search = True
1012
1016
                        mimetype = True
1013
1017
                    elif "domain".startswith(m):
1014
1018
                        domain = True
 
1019
                    else:
 
1020
                        raise ValueError("Invalid search prefix")
1015
1021
                    item = item[1:]
1016
1022
 
1017
1023
                text = item[0]
1052
1058
                                                        brackets=('()', ),
1053
1059
                                                        quotes='\'"')
1054
1060
            logging.debug("parse_quoted_separated items: %r" % items)
1055
 
        except wikiutil.BracketError:
1056
 
            raise ValueError()
 
1061
        except wikiutil.BracketError, err:
 
1062
            raise ValueError(str(err))
1057
1063
        query = self._analyse_items(items)
1058
1064
        logging.debug("analyse_items query: %r" % query)
1059
1065
        return query