Modify

Opened 16 years ago

Last modified 16 years ago

#3937 reopened defect

TypeError when calling /openidverify (/openidlogin before) (0.11.1)

Reported by: ahmann@… Owned by: Dalius
Priority: normal Component: AuthOpenIdPlugin
Severity: blocker Keywords: TypeError openidlogin openidverify
Cc: Trac Release: 0.11

Description

I have successfully installed trac 0.11.1 with basic http auth.

Now i think using openid would be the better option, so i instaled this plugin. Everything looks fine, except when i click on the openidlogin link. See traceback of trac.log below:

2008-10-19 15:40:29,815 Trac[__init__] DEBUG: Dispatching <Request "GET u'/openidlogin'">
2008-10-19 15:40:29,825 Trac[__init__] DEBUG: Retrieving session for ID 'ded37f4ebd5a709edf42cbb1'
2008-10-19 15:40:29,827 Trac[__init__] DEBUG: Prepare chrome data for request
2008-10-19 15:40:29,829 Trac[__init__] DEBUG: action controllers for ticket workflow: ['ConfigurableTicketWorkflow']
2008-10-19 15:40:29,831 Trac[__init__] DEBUG: No policy allowed anonymous performing TICKET_CREATE on None
2008-10-19 15:40:29,834 Trac[__init__] DEBUG: No policy allowed anonymous performing TRAC_ADMIN on None
2008-10-19 15:40:29,834 Trac[__init__] DEBUG: No policy allowed anonymous performing PERMISSION_GRANT on None
2008-10-19 15:40:29,834 Trac[__init__] DEBUG: No policy allowed anonymous performing PERMISSION_REVOKE on None
2008-10-19 15:40:29,834 Trac[__init__] DEBUG: No policy allowed anonymous performing TICKET_ADMIN on None
2008-10-19 15:40:29,834 Trac[__init__] DEBUG: No policy allowed anonymous performing THEME_ADMIN on None
2008-10-19 15:40:29,836 Trac[__init__] DEBUG: beginning OpenID authentication.
2008-10-19 15:40:31,272 Trac[__init__] ERROR: len() of unsized object
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/web/main.py", line 423, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/web/main.py", line 197, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-x86_64/egg/authopenid/authopenid.py", line 178, in process_request
  File "build/bdist.linux-x86_64/egg/authopenid/authopenid.py", line 196, in _do_login
  File "build/bdist.linux-x86_64/egg/authopenid/authopenid.py", line 257, in _do_verify
  File "build/bdist.linux-x86_64/egg/openid/consumer/consumer.py", line 344, in begin
  File "build/bdist.linux-x86_64/egg/openid/yadis/manager.py", line 105, in getNextService
  File "build/bdist.linux-x86_64/egg/openid/consumer/discover.py", line 460, in discover
  File "build/bdist.linux-x86_64/egg/openid/consumer/discover.py", line 452, in discoverURI
  File "build/bdist.linux-x86_64/egg/openid/consumer/discover.py", line 385, in discoverYadis
  File "build/bdist.linux-x86_64/egg/openid/consumer/discover.py", line 191, in fromXRDS
  File "build/bdist.linux-x86_64/egg/openid/yadis/services.py", line 50, in applyFilter
  File "build/bdist.linux-x86_64/egg/openid/yadis/etxrd.py", line 256, in iterServices
  File "build/bdist.linux-x86_64/egg/openid/yadis/etxrd.py", line 244, in prioSort
  File "random.py", line 259, in shuffle
    for i in reversed(xrange(1, len(x))):
TypeError: len() of unsized object

Python 2.4 is installed. python_openid-2.1.1 is installed. http://hg.sandbox.lt/authopenid-plugin/archive/v0.1.2.tar.gz is installed.

Kind regards ! Sashman

Attachments (0)

Change History (16)

comment:1 Changed 16 years ago by Dalius

It looks like you have set default_openid value. If you don't know what's directed identity is don't use it. Could you please give your configuration if that does not help?

comment:2 Changed 16 years ago by Dalius

Resolution: invalid
Status: newclosed

I'm pretty sure that it is configuration issue.

comment:3 Changed 16 years ago by ahmann@…

Keywords: openidverify added
Resolution: invalid
Status: closedreopened
Summary: TypeError when calling /openidlogin (0.11.1)TypeError when calling /openidverify (/openidlogin before) (0.11.1)

(Reopened because somehow related)

Hi there,

It looks like it indeed was a configuration matter. However, i am really missing all configuration options and what they do.

Right now, i followed your lead and removed the directed identity. Now the /openidlogin page doesnt except, but the /openidverify does.

Here is the traceback from debug:

2008-10-21 11:32:04,451 Trac[__init__] DEBUG: Compiling white-list
2008-10-21 11:32:04,451 Trac[__init__] DEBUG: Compiling black-list
2008-10-21 11:32:04,453 Trac[__init__] DEBUG: Dispatching <Request "POST u'/openidverify'">
2008-10-21 11:32:04,556 Trac[__init__] DEBUG: Prepare chrome data for request
2008-10-21 11:32:04,558 Trac[__init__] DEBUG: action controllers for ticket workflow: ['ConfigurableTicketWorkflow']
2008-10-21 11:32:04,560 Trac[__init__] DEBUG: No policy allowed anonymous performing TICKET_CREATE on None
2008-10-21 11:32:04,562 Trac[__init__] DEBUG: No policy allowed anonymous performing TRAC_ADMIN on None
2008-10-21 11:32:04,562 Trac[__init__] DEBUG: No policy allowed anonymous performing PERMISSION_GRANT on None
2008-10-21 11:32:04,562 Trac[__init__] DEBUG: No policy allowed anonymous performing PERMISSION_REVOKE on None
2008-10-21 11:32:04,563 Trac[__init__] DEBUG: No policy allowed anonymous performing TICKET_ADMIN on None
2008-10-21 11:32:04,563 Trac[__init__] DEBUG: No policy allowed anonymous performing THEME_ADMIN on None
2008-10-21 11:32:04,565 Trac[__init__] DEBUG: Retrieving session for ID 'e81daf2cb97e59ccee73949b'
2008-10-21 11:32:04,566 Trac[__init__] DEBUG: beginning OpenID authentication.
2008-10-21 11:32:05,725 Trac[__init__] ERROR: len() of unsized object
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/web/main.py", line 423, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/web/main.py", line 197, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-x86_64/egg/authopenid/authopenid.py", line 207, in process_request
  File "build/bdist.linux-x86_64/egg/authopenid/authopenid.py", line 285, in _do_verify
  File "build/bdist.linux-x86_64/egg/openid/consumer/consumer.py", line 344, in begin
  File "build/bdist.linux-x86_64/egg/openid/yadis/manager.py", line 105, in getNextService
  File "build/bdist.linux-x86_64/egg/openid/consumer/discover.py", line 460, in discover
  File "build/bdist.linux-x86_64/egg/openid/consumer/discover.py", line 452, in discoverURI
  File "build/bdist.linux-x86_64/egg/openid/consumer/discover.py", line 385, in discoverYadis
  File "build/bdist.linux-x86_64/egg/openid/consumer/discover.py", line 191, in fromXRDS
  File "build/bdist.linux-x86_64/egg/openid/yadis/services.py", line 50, in applyFilter
  File "build/bdist.linux-x86_64/egg/openid/yadis/etxrd.py", line 256, in iterServices
  File "build/bdist.linux-x86_64/egg/openid/yadis/etxrd.py", line 244, in prioSort
  File "random.py", line 259, in shuffle
    for i in reversed(xrange(1, len(x))):
TypeError: len() of unsized object

I am simply entering valid openid adresses, with http:// in front and without. It is always triggering this error.

When i entered nonsense, like "dhfjsdfjl", it says at least "Error in discovery: Error fetching XRDS document: &lt;urlopen error (-2, 'Name or service not known')&gt;".

I know the error is thrown in the python-openid package. However, i think this must be due to the configuration again?

My config looks nearly like your example:

[openid]
#default_openid = http://openid.ee
sreg_required = false
whatis = http://openid.net/what/
absolute_trust_root = true
strip_protocol = false
strip_trailing_slash = false
timeout = false

I would be happy to get this thing going, finally.

comment:4 Changed 16 years ago by Dalius

OK. I guess x value in that case is None or something similar. We should find out somehow how this situation happens. The only unusual thing I see is x86_64. Are you using 64 bit OS?

Since I can't reproduce this bug I will need your help. The best you could do is to add more logging. Can you handle that?

comment:5 Changed 16 years ago by anonymous

indeed it is a 64bit system (2.6.18-5-amd64 #1 SMP). How can i enable more logging? The trac conf is already outputting debug level logging.

Can you point me in the right direction?

comment:6 Changed 16 years ago by Dalius

You should add entries in format:

???.debug('something %s' % (repr(x),))

Search for similar entries and just add them to python files. E.g. this file: build/bdist.linux-x86_64/egg/openid/yadis/etxrd.py

Those files should be where you have installed python-openid library.

It really looks like openid library issue.

comment:7 Changed 16 years ago by Dalius

Or simply add strings like this one:

print x

comment:8 Changed 16 years ago by anonymous

i can unpack the source from python-openid-2.1.1, then modify openid/yadis/etxrd.py and then easy_install that one.

But where is the print x output going to?

for example, i added "print e" in the function:

def prioSort(elements):
    """Sort a list of elements that have priority attributes"""
    # Randomize the services before sorting so that equal priority
    # elements are load-balanced.
    random.shuffle(elements)

    prio_elems = [(getPriority(e), e) for e in elements]
    '''print e'''
    prio_elems.sort()
    sorted_elems = [s for (_, s) in prio_elems]
    return sorted_elems

But i dont know where this output is going to (as i said, i have never done any python)

comment:9 Changed 16 years ago by anonymous

print e = print e (bold formatting not applied to a code block)

comment:10 Changed 16 years ago by Dalius

You can actually do it this way. Unpack and run command: python setup.py develop (where setup.py file is). This way you can modify *.py files in place. You will only need to restart trac server.

print issue. You must run tracd deamon (no apache or other web server) because print outputs to standard output: tracd -p 8080 /path/to/trac

comment:11 Changed 16 years ago by Dalius

BTW. What DB are you using? PosgresSql is not tested on my side. SQLite and MySql are tested.

comment:12 Changed 16 years ago by anonymous

In the directory where the setup.py is, i entered "python setup.py develop"

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help

error: invalid command 'develop'

This doesnt seem to work.

I also started tracd standalone, but it didnt output anything except all the files that are being processed by GET or POST.

sqlite is used. I also made sure python sqlite2 interface is installed.

comment:13 Changed 16 years ago by Dalius

OK. That might be possible that openid library is not written properly.

About tracd. Make sure you have proper entries in trac.ini for logging:

[logging] log_file = trac.log log_level = DEBUG log_type = stderr

print statement should work unless there is something done what eats all output to standard output. That's OK that you see GET and POST statement but I think you should be able to see output from print statement. You can make it more visible this way:

print '*'*80 # print 80 asterisks print ... print '*'*80

comment:14 Changed 16 years ago by anonymous

ok. I have put print '*'*80 into it, to see if there is any ouput at all, which is not. (stderr is showing the debug now).

Right now i am out of options here, and i feel the pain explaining simple python, especially when it is a problem with python-openid, and not your plugin.

How do you think is the best way to further proceed?

comment:15 Changed 16 years ago by Dalius

You could try newer python openid library. Maybe that will work?

comment:16 Changed 16 years ago by Dalius

BTW you can create ticket in python openid library http://trac.openidenabled.com/trac/report/1

Modify Ticket

Change Properties
Set your email in Preferences
Action
as reopened The owner will remain Dalius.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.