j2labs / listsurf

Simple website implemented in Brubeck
62 stars 11 forks source link

New Install gives me object encoding error #6

Open reduxdj opened 11 years ago

reduxdj commented 11 years ago

Brubeck going down... (listsurf)quadcore-imac:listsurf dj$ ./listsurf.py INFO:root:Using coroutine library: eventlet Brubeck v0.4.0 online ]----------------------------------- ERROR:root:Credentials failed ERROR:root:Unicode-objects must be encoded before hashing INFO:root:200 POST /create (127.0.0.1)

j2labs commented 11 years ago

Please provide more informationsoI can reproduce.

On Saturday, August 31, 2013, Patrick Lemiuex wrote:

Brubeck going down... (listsurf)quadcore-imac:listsurf dj$ ./listsurf.py INFO:root:Using coroutine library: eventlet Brubeck v0.4.0 online ]----------------------------------- ERROR:root:Credentials failed ERROR:root:Unicode-objects must be encoded before hashing INFO:root:200 POST /create (127.0.0.1)

— Reply to this email directly or view it on GitHubhttps://github.com/j2labs/listsurf/issues/6 .

reduxdj commented 11 years ago

I started the server, and tried to post an object to the handler. Then the error came up. Not sure, but I don't get any errors in the template, I don't know what ERROR:root:Credentials failed -- mongodb issue?

reduxdj commented 11 years ago

HTH:

Sun, 01 Sep 2013 03:14:50 GMT [ERROR](src/unixy.c:55: errno: Operation not permitted) Can't chroot to ./, rerun as root if this is what you want. Sun, 01 Sep 2013 03:14:50 GMT [WARN](src/mongrel2.c:243: errno: None) Couldn't chroot too ./, assuming running in test mode. Sun, 01 Sep 2013 03:14:50 GMT INFO Starting 0MQ with 1 threads. Sun, 01 Sep 2013 03:14:50 GMT INFO MAX limits.header_count=1280 Sun, 01 Sep 2013 03:14:50 GMT INFO MAX limits.content_length=20480, limits.buffer_size=4096, limits.connection_stack_size=32768, limits.client_read_retries=5 Sun, 01 Sep 2013 03:14:50 GMT INFO MAX limits.proxy_read_retries=100, limits.proxy_read_retry_warn=10 Sun, 01 Sep 2013 03:14:50 GMT INFO MAX limits.fdtask_stack=102400 Sun, 01 Sep 2013 03:14:50 GMT INFO MAX allowing limits.handler_targets=128 Sun, 01 Sep 2013 03:14:50 GMT INFO Binding handler PUSH socket tcp://127.0.0.1:9999 with identity: 34f9ceee-cd52-4b7f-b197-88bf2f0ec378 Sun, 01 Sep 2013 03:14:50 GMT INFO Binding listener SUB socket tcp://127.0.0.1:9998 subscribed to: Sun, 01 Sep 2013 03:14:50 GMT INFO Setting up control socket in at ipc://run/control Sun, 01 Sep 2013 03:14:50 GMT INFO -- Mongrel2/1.8.1 Running. Copyright (C) Zed A. Shaw. Licensed BSD.

j2labs commented 11 years ago

Looks like the user authentication is failing. That particular section of the code is for creating a user.

Could you share the data you are using as input for validation? This means the username, password, and email values used to create the user.

On Sun, Sep 1, 2013 at 1:08 AM, Patrick Lemiuex notifications@github.comwrote:

HTH:

Sun, 01 Sep 2013 03:14:50 GMT ERRORhttp://src/unixy.c:55:%20errno:%20Operation%20not%20permittedCan't chroot to ./, rerun as root if this is what you want. Sun, 01 Sep 2013 03:14:50 GMT WARNhttp://src/mongrel2.c:243:%20errno:%20NoneCouldn't chroot too ./, assuming running in test mode. Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/server.c:271 Starting 0MQ with 1 threads. Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/request.c:57 MAX limits.header_count=1280 Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/connection.c:1029 MAX limits.content_length=20480, limits.buffer_size=4096, limits.connection_stack_size=32768, limits.client_read_retries=5 Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/connection.c:1035 MAX limits.proxy_read_retries=100, limits.proxy_read_retry_warn=10 Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/task/fd.c:153 MAX limits.fdtask_stack=102400 Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/handler.c:208 MAX allowing limits.handler_targets=128 Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/handler.c:290 Binding handler PUSH socket tcp://127.0.0.1:9999 with identity: 34f9ceee-cd52-4b7f-b197-88bf2f0ec378 Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/handler.c:316 Binding listener SUB socket tcp://127.0.0.1:9998 subscribed to: Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/control.c:423 Setting up control socket in at ipc://run/control Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/mongrel2.c:274 -- Mongrel2/1.8.1 Running. Copyright (C) Zed A. Shaw. Licensed BSD.

— Reply to this email directly or view it on GitHubhttps://github.com/j2labs/listsurf/issues/6#issuecomment-23619043 .

reduxdj commented 11 years ago

Patrick password patricklemiuex AT gmail.com

What's weird, is why does the form redirect to / - shouldn't it not allow the post?

On Sun, Sep 1, 2013 at 11:18 AM, James Dennis notifications@github.comwrote:

Looks like the user authentication is failing. That particular section of the code is for creating a user.

Could you share the data you are using as input for validation? This means the username, password, and email values used to create the user.

On Sun, Sep 1, 2013 at 1:08 AM, Patrick Lemiuex notifications@github.comwrote:

HTH:

Sun, 01 Sep 2013 03:14:50 GMT ERROR< http://src/unixy.c:55:%20errno:%20Operation%20not%20permitted>Can't chroot to ./, rerun as root if this is what you want. Sun, 01 Sep 2013 03:14:50 GMT WARN< http://src/mongrel2.c:243:%20errno:%20None>Couldn't chroot too ./, assuming running in test mode. Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/server.c:271 Starting 0MQ with 1 threads. Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/request.c:57 MAX limits.header_count=1280 Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/connection.c:1029 MAX limits.content_length=20480, limits.buffer_size=4096, limits.connection_stack_size=32768, limits.client_read_retries=5 Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/connection.c:1035 MAX limits.proxy_read_retries=100, limits.proxy_read_retry_warn=10 Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/task/fd.c:153 MAX limits.fdtask_stack=102400 Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/handler.c:208 MAX allowing limits.handler_targets=128 Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/handler.c:290 Binding handler PUSH socket tcp://127.0.0.1:9999 with identity: 34f9ceee-cd52-4b7f-b197-88bf2f0ec378 Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/handler.c:316 Binding listener SUB socket tcp://127.0.0.1:9998 subscribed to: Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/control.c:423 Setting up control socket in at ipc://run/control Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/mongrel2.c:274 -- Mongrel2/1.8.1 Running. Copyright (C) Zed A. Shaw. Licensed BSD.

— Reply to this email directly or view it on GitHub< https://github.com/j2labs/listsurf/issues/6#issuecomment-23619043> .

— Reply to this email directly or view it on GitHubhttps://github.com/j2labs/listsurf/issues/6#issuecomment-23626758 .

reduxdj commented 11 years ago

BTW, the db is empty.

reduxdj commented 11 years ago

from pymongo import MongoClient db_conn = init_db_conn() u = User.create_user('patrick','password','patricklemiuexAT !gmail.com') u.validate() True save_user(self.db_conn, u) Traceback (most recent call last): File "", line 1, in NameError: name 'self' is not defined save_user(db_conn, u) ObjectId('52239248b532f734801e433e')

What's weird is I think there's a unicode problem when I post to the handler... that's why validation is failing

reduxdj commented 11 years ago

The problem looks to be the version of bcrypt i am using, the password is coming in as unicode problem. I hate python unicoding!

File "/Users/dj/.virtualenvs/listsurf/lib/python2.7/site-packages/brubeck/request_handling.py", line 325, in call rendered = fun(*self._url_args) File "/Users/dj/.virtualenvs/listsurf/lib/python2.7/site-packages/brubeck/auth.py", line 75, in wrapper if not self.current_user: File "/Users/dj/.virtualenvs/listsurf/lib/python2.7/site-packages/brubeck/auth.py", line 110, in current_user self._current_user = self.get_current_user() File "/Users/dj/listsurf/handlers.py", line 55, in get_current_user if not user.check_password(password): File "/Users/dj/.virtualenvs/listsurf/lib/python2.7/site-packages/brubeck/models.py", line 58, in check_password algorithm=algorithm, salt=salt) File "/Users/dj/.virtualenvs/listsurf/lib/python2.7/site-packages/brubeck/auth.py", line 35, in gen_hexdigest return (algorithm, salt, bcrypt.hashpw(raw_password, salt)) File "/Users/dj/.virtualenvs/listsurf/lib/python2.7/site-packages/bcrypt/init.py", line 91, in hashpw raise TypeError("Unicode-objects must be encoded before hashing") TypeError: Unicode-objects must be encoded before hashing INFO:root:404 POST /login (127.0.0.1)

reduxdj commented 11 years ago

https://github.com/j2labs/brubeck/pull/118 covers this