txjsonrpc.auth has reference to twisted.web and twisted.web2

Bug #477902 reported by Sergey Kotov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
txJSON-RPC
Fix Committed
Medium
Duncan McGreggor

Bug Description

auth dosn't work if installed only twisted.web(or web2)

Revision history for this message
Sergey Kotov (sergey-kotov) wrote :

There are many ways to fix it.
Duncan, I want to fix.

May be divide auth to 2 modules in txjsonrpc/web/auth.py and tx~~/web2/auth ?

Revision history for this message
Duncan McGreggor (oubiwann) wrote : Re: [Bug 477902] Re: txjsonrpc.auth has reference to twisted.web and twisted.web2

Sergey Kotov wrote:
> There are many ways to fix it.
> Duncan, I want to fix.
>
> May be divide auth to 2 modules in txjsonrpc/web/auth.py and
> tx~~/web2/auth ?
>

Yeah, I forget that folks don't just install all of Twisted ;-)

I think my preferred way to fix this would be to split that one import
into two, wrap a try/except block around it, and set the module (web or
web2) to None on ImportError. Then I'd raise an ImportError (with a nice
message) in the dependent functions below if the appropriate module was
None.

If this is something that you want to code, you can create a branch and
push it to lp:~yourusername/txjsonrpc/yourbranchname. Once it's done,
you can submit it for review, and I'll check it out and give you feedback.

If that's not what you meant, then I can code this up pretty quickly ;-)

Thanks!

d

Revision history for this message
Sergey Kotov (sergey-kotov) wrote :

You way better. I think about this, but didn't use that before.
I am busy about 3 days,becouse go to Google DevDay to Moscow.

Revision history for this message
Duncan McGreggor (oubiwann) wrote : Re: [Bug 477902] Re: txjsonrpc.auth has reference to twisted.web and twisted.web2

Great! I'm at the Ubuntu Developer Summit now (a week early) and have
already started working on it. I'm also adding unit tests for the auth
module.

Thanks again for bringing this up!

Enjoy Google DevDay!

d

On Sun, Nov 8, 2009 at 12:15 PM, Sergey Kotov <email address hidden> wrote:
> You way better. I think about this, but didn't use that before.
> I am busy about 3 days,becouse go to Google DevDay to Moscow.
>
> --
> txjsonrpc.auth has reference to twisted.web and twisted.web2
> https://bugs.launchpad.net/bugs/477902
> You received this bug notification because you are the registrant for
> txJSON-RPC.
>

Changed in txjsonrpc:
importance: Undecided → Medium
assignee: nobody → Duncan McGreggor (oubiwann)
status: New → In Progress
Revision history for this message
Duncan McGreggor (oubiwann) wrote :

These changes have been merged to trunk.

Changed in txjsonrpc:
status: In Progress → Fix Committed
Revision history for this message
Sergey Kotov (sergey-kotov) wrote :

I change auth.py on lp:~sergey-kotov/txjsonrpc/auth
to raise ImportError if web and web2 are None

Revision history for this message
Duncan McGreggor (oubiwann) wrote : Re: [Bug 477902] Re: txjsonrpc.auth has reference to twisted.web and twisted.web2

Sergey Kotov wrote:
> I change auth.py on lp:~sergey-kotov/txjsonrpc/auth
> to raise ImportError if web and web2 are None

Hey Sergey,

The raise you added to wrapResource isn't needed -- the private
functions that are called in wrapResource already do that.

Likewise, the only places that instantiates the HTTPAuthRealm are the
private functions, which are already "protected".

Trunk should work for anyone that doesn't have either web or web2
installed. The appropriate error should be raised when one tries to wrap
a resource. However, the wrapping that takes place depends upon the type
of resource implemented... so if you don't have web2 installed, it's
going to be very difficult to call _wrapTwistedWeb2Resource!

That being said, are you still seeing an error? If you are seeing an
error, can you paste your code and the error that you see?

Thanks!

d

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.