Edgewall Software
Modify

Opened 19 years ago

Closed 18 years ago

#900 closed defect (worksforme)

tracd login, internal error

Reported by: sky-g Owned by: Jonas Borgström
Priority: normal Milestone:
Component: web frontend/tracd Version: 0.7.1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Traceback

Oops...
Trac detected an internal error:

'int' object has no attribute 'lower'
Traceback (most recent call last):
  File "/usr/bin/tracd", line 233, in do_trac_req
    self.do_real_trac_req()
  File "/usr/bin/tracd", line 243, in do_real_trac_req
    self.remote_user = self.env.auth.do_auth(self)
  File "/usr/bin/tracd", line 99, in do_auth
    if not 'Authorization' in req.headers or \
  File "/usr/lib/python2.2/rfc822.py", line 390, in __getitem__
    return self.dict[name.lower()]
AttributeError: 'int' object has no attribute 'lower'

Related info

tracd is started with:

 #! /bin/sh
db_name=trac  
repos=/var/www/trac
port=9000
tracd=/usr/bin/tracd
pythonpath=/usr/local/lib/svn-python:/usr/lib/python2.2/site-packages 
libpath=/usr/local/lib
htd_passwords=/var/www/trac/htdigest
#-----------------------------------------------------------

LD_LIBRARY_PATH=$libpath \
PYTHONPATH=$pythonpath \
     $tracd --port $port --auth $db_name,$htd_passwords,trac $repos &

"repos" is not the subversion repository of course, but the trac environment.

Notes / ideas:

  • Tried to make db_name and last directory in "repos" the same, as prescribed by various pages. (Is this understood correctly?)
  • The project name given when doing initenv, which appears in headers of HTML pages - does that matter? (tried redoing it with same name, does not seem to matter…)
  • Just noticed, the "realm" is not a complete or correct hostname if that matters, just "trac"

/var/www/trac/htdigest contains only one line:

gan:trac:44ab342...<the hashed password>...

with these permissions (nothing odd I guess, probably shouldn't be world readable though…)

-rwxr-xr-x 1 root root 42 Nov  9 18:52 /var/www/trac/htdigest

Attachments (1)

ticket_900_ugly_patch.patch (813 bytes ) - added by sky-g 19 years ago.
rough patch (workaround)

Download all attachments as: .zip

Change History (5)

comment:1 by sky-g, 19 years ago

To clarify, the error trace appears anytime I try clicking "Login"

comment:2 by sky-g, 19 years ago

Looks like a strange python bug. Hope you gurus will figure it out.

rfc822.py contains

   # Access as a dictionary (only finds *last* header of each type):
   def __getitem__(self, name):
       """Get a specific header, as from a dictionary."""
       return self.dict[name.lower()]

If I understand the error, then 'Authorization' gets turned into an int when entering the local __getitem__ ???

Anyway I wrote a workaround avoiding the __getitem__ implementation in headers by accessing the internal dictionary directly, (not very nice) using a lower-cased key.

i.e.:

if not 'Authorization' in req.headers

changed to

if not 'authorization' in req.headers.dict

and so on.

Works for me! (Yay!) It seems a bit fragile to access the member "dict" directly however so I leave it up to you to use the ugly patch, or figure out the problem.

I did not affect the other places where other dictionary-like accesses are made. Please investigate them too. For example:

        if self.headers.has_key('Cookie'):
            self.incookie.load(self.headers['Cookie'])

    def get_header(self, name):
        return self.headers.get(name)

By the way I'm using python 2.2 ! Could be a bug only in that version perhaps…

by sky-g, 19 years ago

Attachment: ticket_900_ugly_patch.patch added

rough patch (workaround)

comment:3 by Christopher Lenz, 19 years ago

Milestone: 0.7.1

comment:4 by Matthew Good, 18 years ago

Resolution: worksforme
Status: newclosed

Wow, 0.7.1 is old. I think this was probably fixed long ago in the changes that have happened since then.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.