2 Commits f3e0c86077 ... c0a38b3d80

Author SHA1 Message Date
  zPlus c0a38b3d80 Fix database REGEXP function. Use re.search() instead of re.match(). 5 years ago
  zPlus 8b6922c333 Remove print() instruction. 5 years ago
2 changed files with 2 additions and 2 deletions
  1. 1 1
      freepost/__init__.py
  2. 1 1
      freepost/database.py

+ 1 - 1
freepost/__init__.py

@@ -214,7 +214,7 @@ def login_check ():
     
     # Start new session
     session.start (user['id'], remember)
-    print(user)
+    
     # Redirect logged in user to preferred feed
     if user['preferred_feed'] == 'new':
         redirect (application.get_url ('homepage') + '?sort=new')

+ 1 - 1
freepost/database.py

@@ -19,7 +19,7 @@ db.create_function('SHA512', 1, lambda text:
 # function named "regexp" is added at run-time, then the "X REGEXP Y" operator
 # will be implemented as a call to "regexp(Y,X)".
 db.create_function('REGEXP', 2, lambda pattern, string:
-                                    re.match(pattern, string, flags=re.IGNORECASE) is not None)
+                                    re.search(pattern, string, flags=re.IGNORECASE) is not None)
 
 # Store a new session_id for a user that has logged in
 # The session token is stored in the user cookies during login, here