Thomas Waldmann avatar Thomas Waldmann committed dab5196

import terms module from new location

Comments (0)

Files changed (8)

MoinMoin/converter/include.py

 
                 elif xp_include_pages:
                     # We have a regex of pages to include
-                    from MoinMoin.search.term import NameFn
+                    from MoinMoin.storage.terms import NameFn
                     inc_match = re.compile(xp_include_pages)
                     root_item = Item(name=u'')
                     pagelist = [item.name for item in root_item.list_items(NameFn(inc_match))]

MoinMoin/items/__init__.py

     def get_index(self):
         """ create an index of sub items of this item """
         import re
-        from MoinMoin.search.term import NameRE
+        from MoinMoin.storage.terms import NameRE
 
         if self.name:
             prefix = self.name + u'/'
 
     def get_templates(self, mimetype=None):
         """ create a list of templates (for some specific mimetype) """
-        from MoinMoin.search.term import AND, LastRevisionMetaDataMatch
+        from MoinMoin.storage.terms import AND, LastRevisionMetaDataMatch
         term = LastRevisionMetaDataMatch(TAGS, ['template']) # XXX there might be other tags
         if mimetype:
             term = AND(term, LastRevisionMetaDataMatch(MIMETYPE, mimetype))

MoinMoin/script/maint/reduce_revisions.py

 from flask import current_app as app
 from flaskext.script import Command, Option
 
-from MoinMoin.search import term
+from MoinMoin.storage.terms import NameRE
 
 
 class Reduce_Revisions(Command):
 
     def run(self, pattern):
         storage = app.unprotected_storage
-        query = term.NameRE(re.compile(pattern))
+        query = NameRE(re.compile(pattern))
         # If no pattern is given, the default regex will match every item.
         for item in storage.search_items(query):
             current_revno = item.next_revno - 1

MoinMoin/script/maint/set_meta.py

 from flaskext.script import Command, Option
 
 from MoinMoin.script import fatal
-from MoinMoin.search import term
+from MoinMoin.storage.terms import NameRE
 from MoinMoin.storage.error import NoSuchRevisionError
 
 class Set_Meta(Command):
             fatal("You need to either specify a proper key/value pair or "
                   "only a key you want to delete (with -r set).")
 
-        query = term.NameRE(re.compile(pattern))
+        query = NameRE(re.compile(pattern))
         for item in storage.search_items(query):
             try:
                 last_rev = item.get_revision(-1)

MoinMoin/storage/_tests/test_backends.py

 from MoinMoin.storage import Item, NewRevision
 from MoinMoin.storage.backends import memory
 from MoinMoin.storage.error import NoSuchItemError, ItemAlreadyExistsError, NoSuchRevisionError, RevisionAlreadyExistsError
-from MoinMoin.search import term
+from MoinMoin.storage import terms
 
 item_names = (u"quite_normal",
               u"äöüßłóąćółąńśćżź",
             self.create_rev_item_helper(name)
         self.create_meta_item_helper(u"new_song_player")
         query_string = u"song"
-        query = term.Name(query_string, True)
+        query = terms.Name(query_string, True)
         for num, item in enumerate(self.backend.search_items(query)):
             assert item.name.find(query_string) != -1
         assert num == 2
             assert len(found) == expected
 
         # must be /part/ of the name
-        yield _test_search, term.Name(u'AbCdEf', False), 3
-        yield _test_search, term.Name(u'AbCdEf', True), 0
-        yield _test_search, term.Name(u'abcdef', True), 3
-        yield _test_search, term.NameRE(re.compile(u'abcde.*')), 4
-        yield _test_search, term.NameFn(lambda n: n == u'abcdef'), 1
+        yield _test_search, terms.Name(u'AbCdEf', False), 3
+        yield _test_search, terms.Name(u'AbCdEf', True), 0
+        yield _test_search, terms.Name(u'abcdef', True), 3
+        yield _test_search, terms.NameRE(re.compile(u'abcde.*')), 4
+        yield _test_search, terms.NameFn(lambda n: n == u'abcdef'), 1
 
     def test_iteritems_1(self):
         for num in range(10, 20):

MoinMoin/storage/_tests/test_terms.py

 
 import re
 
-from MoinMoin.search import term
+from MoinMoin.storage import terms as term
 from MoinMoin.storage.backends.memory import MemoryBackend
 
 
         for item, expected in [('c', False), ('Lorem', True), ('lorem', True), ('LOREM', True), ('NR', False)]:
             yield self._evaluate, t, item, expected
 
-coverage_modules = ['MoinMoin.search.terms']
+coverage_modules = ['MoinMoin.storage.terms']

MoinMoin/storage/serialization.py

 
 class TermMatch(XMLSelectiveGenerator):
     def __init__(self, out, term):
-        self.term = term  # see MoinMoin.search.term
+        self.term = term  # see MoinMoin.storage.terms
         XMLSelectiveGenerator.__init__(self, out)
 
     def shall_serialize(self, item=None, rev=None,
 
 def get_by_filter(key, value):
     """ Searches for an user with a given filter """
-    from MoinMoin.search import term
-    filter = term.ItemMetaDataMatch(key, value)
-    items = get_user_backend().search_items(filter)
+    from MoinMoin.storage.terms import ItemMetaDataMatch
+    items = get_user_backend().search_items(ItemMetaDataMatch(key, value))
     users = [User(item.name) for item in items]
     return users
 
     :rtype: string
     :returns: the corresponding user ID or None
     """
-    from MoinMoin.search import term
+    from MoinMoin.storage.terms import ItemMetaDataMatch
     try:
         backend = get_user_backend()
-        for user in backend.search_items(term.ItemMetaDataMatch('name', searchName)):
+        for user in backend.search_items(ItemMetaDataMatch('name', searchName)):
             return user.name
         return None
     except IndexError:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.