[Erp5-report] r19262 - in /erp5/trunk/products/ZSQLCatalog: SearchKey/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 12 10:09:57 CET 2008


Author: jerome
Date: Tue Feb 12 10:09:56 2008
New Revision: 19262

URL: http://svn.erp5.org?rev=19262&view=rev
Log:
include "." character in the definition of WORD token 

Modified:
    erp5/trunk/products/ZSQLCatalog/SearchKey/DefaultKey.py
    erp5/trunk/products/ZSQLCatalog/SearchKey/FullTextKey.py
    erp5/trunk/products/ZSQLCatalog/SearchKey/KeyWordKey.py
    erp5/trunk/products/ZSQLCatalog/tests/testSearchKeys.py

Modified: erp5/trunk/products/ZSQLCatalog/SearchKey/DefaultKey.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SearchKey/DefaultKey.py?rev=19262&r1=19261&r2=19262&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SearchKey/DefaultKey.py (original)
+++ erp5/trunk/products/ZSQLCatalog/SearchKey/DefaultKey.py Tue Feb 12 10:09:56 2008
@@ -83,7 +83,7 @@
   t_LESSTHAN = r'<'
 
   def t_WORD(self, t):
-    r'[\x7F-\xFF\w\d\/\-~!@#$%^&*()_+\n][\x7F-\xFF\w\d\/\-~!@#$%^&*()_+\n]*'
+    r'[\x7F-\xFF\w\d\/\.\-~!@#$%^&*()_+\n][\x7F-\xFF\w\d\/\.\-~!@#$%^&*()_+\n]*'
     #r'[\x7F-\xFF\w\d\/%][\x7F-\xFF\w\d\/%]*'
     # WORD may contain arbitrary letters and numbers without white space
     # WORD may contain '%' but not at the beginning or end (otherwise it's KEYWORD)
@@ -92,7 +92,7 @@
     return t
 
   def t_WORDSET(self, t):
-    r'"[\x7F-\xFF\w\d\s\/~!@#$%^&*()_+][\x7F-\xFF\w\d\s\/~!@#$%^&*()_+]*"'
+    r'"[\x7F-\xFF\w\d\s\/\.~!@#$%^&*()_+][\x7F-\xFF\w\d\s\/\.~!@#$%^&*()_+]*"'
     #r'"[\x7F-\xFF\w\d\s/%][\x7F-\xFF\w\d\s/%]*"'
     # WORDSET is a combination of WORDs separated by white space
     # and starting/ending with "

Modified: erp5/trunk/products/ZSQLCatalog/SearchKey/FullTextKey.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SearchKey/FullTextKey.py?rev=19262&r1=19261&r2=19262&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SearchKey/FullTextKey.py (original)
+++ erp5/trunk/products/ZSQLCatalog/SearchKey/FullTextKey.py Tue Feb 12 10:09:56 2008
@@ -58,7 +58,7 @@
   t_DOUBLEQUOTE = r'(\")'
 
   def t_WORD(self, t):
-    r'[\x7F-\xFF\w\d\/!@#$%^&_][\x7F-\xFF\w\d\/!@#$%^&_]*'
+    r'[\x7F-\xFF\w\d\/\.!@#$%^&_][\x7F-\xFF\w\d\/\.!@#$%^&_]*'
     #r'[\x7F-\xFF\w\d][\x7F-\xFF\w\d]*'
     # WORD may contain arbitrary letters and numbers without white space
     word_value = t.value

Modified: erp5/trunk/products/ZSQLCatalog/SearchKey/KeyWordKey.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SearchKey/KeyWordKey.py?rev=19262&r1=19261&r2=19262&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SearchKey/KeyWordKey.py (original)
+++ erp5/trunk/products/ZSQLCatalog/SearchKey/KeyWordKey.py Tue Feb 12 10:09:56 2008
@@ -92,7 +92,7 @@
   t_LESSTHAN = r'<'
 
   def t_EXPLICITEQUALLITYWORD(self, t):
-    r'=[\x7F-\xFF\w\d\/~!@#$^&*()_+][\x7F-\xFF\w\d\/~!@#$^&*()_+]*'
+    r'=[\x7F-\xFF\w\d\/\.~!@#$^&*()_+][\x7F-\xFF\w\d\/\.~!@#$^&*()_+]*'
     # EXPLICITEQUALLITYWORD may contain arbitrary letters and numbers without white space
     # EXPLICITEQUALLITYWORD must contain '=' at the beginning
     value = t.value.strip()
@@ -101,7 +101,7 @@
     return t
 
   def t_KEYWORD(self, t):
-    r'%?[\x7F-\xFF\w\d/~!@#$%^&*()_+][\x7F-\xFF\w\d/~!@#$%^&*()_+]*%?'
+    r'%?[\x7F-\xFF\w\d/\.~!@#$%^&*()_+][\x7F-\xFF\w\d/\.~!@#$%^&*()_+]*%?'
     # KEYWORD may starts(1) and may ends (2) with '%' but always must either #1 or #2
     # be true. It may contains arbitrary letters, numbers and white space
     value = t.value.strip()
@@ -111,7 +111,7 @@
     return t    
     
   def t_WORD(self, t):
-    r'[\x7F-\xFF\w\d\/~!@#$^&*()_+][\x7F-\xFF\w\d\/~!@#$^&*()_+]*'
+    r'[\x7F-\xFF\w\d\/\.~!@#$^&*()_+][\x7F-\xFF\w\d\/\.~!@#$^&*()_+]*'
     # WORD may contain arbitrary letters and numbers without white space
     # WORD may contain '%' but not at the beginning or end (otherwise it's KEYWORD)
     value = t.value.strip()
@@ -119,7 +119,7 @@
     return t     
   
   def t_WORDSET(self, t):
-    r'=?"[\x7F-\xFF\w\d\s\/~!@#$%^&*()_+][\x7F-\xFF\w\d\s\/~!@#$%^&*()_+]*"'
+    r'=?"[\x7F-\xFF\w\d\s\/\.~!@#$%^&*()_+][\x7F-\xFF\w\d\s\/\.~!@#$%^&*()_+]*"'
     # WORDSET is a combination of WORDs separated by white space
     # and starting/ending with " (optionally with '=')
     value = t.value.replace('"', '')

Modified: erp5/trunk/products/ZSQLCatalog/tests/testSearchKeys.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/tests/testSearchKeys.py?rev=19262&r1=19261&r2=19262&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/tests/testSearchKeys.py (original)
+++ erp5/trunk/products/ZSQLCatalog/tests/testSearchKeys.py Tue Feb 12 10:09:56 2008
@@ -84,6 +84,7 @@
     self.compare(DefaultKey, 
                 'S\xc3\xa9bastien or !="Doe John1" and Doe', 
                 ('WORD', 'OR', 'NOT', 'WORDSET', 'AND', 'WORD',))  
+    self.compare(DefaultKey, '.', ('WORD',))
                              
   def test_03KeyWordKey(self, quiet=quiet, run=run_all_test):
     """ Check lexer for KeyWordKey."""
@@ -105,6 +106,7 @@
     self.compare(KeyWordKey, '=John% and >="JOHN John"', 
                             ('EXPLICITEQUALLITYWORD', 'KEYWORD', 'AND', 
                              'GREATERTHANEQUAL', 'WORDSET',))
+    self.compare(KeyWordKey, '.', ('WORD',))
                              
   def test_04DateTimeKey(self, quiet=quiet, run=run_all_test):
     """ Check lexer for DateTimeKey."""
@@ -125,6 +127,7 @@
                  ('WORD', 'WORD',)) 
     self.compare(FullTextKey, '+John -Doe', 
                  ('PLUS', 'WORD', 'MINUS', 'WORD',)) 
+    self.compare(FullTextKey, '.', ('WORD',))
 
   def test_06ScriptableKey(self, quiet=quiet, run=run_all_test):
     """ Check lexer for ScriptableKey."""  
@@ -199,6 +202,12 @@
                 '%John and !=Doe%', 
                 "((((title = '%John') AND (title != 'Doe%'))))",
                 [])
+    # special chars
+    self.compare(DefaultKey,
+                 'title',
+                 '.',
+                 "((((title = '.'))))",
+                 [])
                 
   def test_02KeyWordKey(self, quiet=quiet, run=run_all_test):
     """ Check DefaultKey query generation"""
@@ -228,6 +237,12 @@
                 '%John Doe% or =Doe John', 
                 "((((title LIKE '%John Doe%'))) OR (((title = 'Doe John'))))",
                 [])       
+    # special chars
+    self.compare(KeyWordKey,
+                 'title',
+                 '.',
+                 "((((title LIKE '%.%'))))",
+                 [])
                 
   def test_03DateTimeKey(self, quiet=quiet, run=run_all_test):
     """ Check DefaultKey query generation"""
@@ -349,6 +364,12 @@
                 '1ab521ty', 
                 "delivery.stock = '1ab521ty'",
                 [])    
+    # special chars
+    self.compare(RawKey,
+                 'delivery.stock',
+                 '.',
+                 "delivery.stock = '.'",
+                 [])
                 
   def test_06FullTextKey(self, quiet=quiet, run=run_all_test):
     """ Check FullTextKey query generation"""
@@ -359,6 +380,14 @@
                 "MATCH full_text.SearchableText AGAINST ('john' )",
                 ["MATCH full_text.SearchableText AGAINST ('john' ) AS full_text_SearchableText_relevance", 
                 "MATCH full_text.SearchableText AGAINST ('john' ) AS SearchableText_relevance"])    
+
+    # special chars
+    self.compare(FullTextKey,
+                'full_text.SearchableText',
+                '.',
+                "MATCH full_text.SearchableText AGAINST ('.' )",
+                ["MATCH full_text.SearchableText AGAINST ('.' ) AS full_text_SearchableText_relevance",
+                "MATCH full_text.SearchableText AGAINST ('.' ) AS SearchableText_relevance"])
     
   def test_07ScriptableKey(self, quiet=quiet, run=run_all_test):
     """ Check ScriptableKey query generation"""




More information about the Erp5-report mailing list