web/webconfig.py
changeset 9340 b1e933b0e850
parent 9257 ce338133c92c
parent 9326 9d145b4c4e53
child 9372 e87a808a4c32
--- a/web/webconfig.py	Mon Sep 09 12:43:25 2013 +0200
+++ b/web/webconfig.py	Mon Dec 09 16:13:10 2013 +0100
@@ -135,7 +135,7 @@
         ('https-deny-anonymous',
          {'type': 'yn',
           'default': False,
-          'help': 'Prevent anonymous user to browse thought https version of '
+          'help': 'Prevent anonymous user to browse through https version of '
                   'the site (https-url). Login form will then be displayed '
                   'until logged',
           'group': 'web',
@@ -296,6 +296,9 @@
 
     def sign_text(self, text):
         """sign some text for later checking"""
+        # hmac.new expect bytes
+        if isinstance(text, unicode):
+            text = text.encode('utf-8')
         # replace \r\n so we do not depend on whether a browser "reencode"
         # original message using \r\n or not
         return hmac.new(self._instance_salt,
@@ -305,7 +308,6 @@
         """check the text signature is equal to the given signature"""
         return self.sign_text(text) == signature
 
-
     def locate_resource(self, rid):
         """return the (directory, filename) where the given resource
         may be found