Module hack in gateways seems to cause some problems

View: New views
17 Messages — Rating Filter:   Alert me  

Module hack in gateways seems to cause some problems

by bart vandendriessche-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey all,

We've been running into some weird problems using the DjangoGateway. The symptoms were as follows:

We would start up the django server, check the admin then check the amfgateway and things would work fine. However, if we visited a page in the admin that we had not visited before, after posting something to the gateway, we would get weird import errors.

After some experimenting, it seems like the import hack is the culprit of our problems.

Basically, after the import hack is run, the django module is modified in such a way that any submodule that was not imported before can no longer be imported.

For now I solved the problem by creating a djangogateway.py module inside the gateway module, which is a copy of django.py without the import hack.

Cheers,
Bart

Re: Module hack in gateways seems to cause some problems

by Nick Joyce :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey,

Thanks for this, should be fixed in r498.

Basically the pyamf.gateway.django module name was screwing up further
imports to the real django module.

Let me know how you get on with this. :)

Cheers,

Nick

On Thu, December 6, 2007 11:45 am, bart vandendriessche wrote:

> Hey all,
>
>
> We've been running into some weird problems using the DjangoGateway. The
> symptoms were as follows:
>
> We would start up the django server, check the admin then check the
> amfgateway and things would work fine. However, if we visited a page in
> the admin that we had not visited before, after posting something to the
> gateway, we would get weird import errors.
>
> After some experimenting, it seems like the import hack is the culprit of
>  our problems.
>
> Basically, after the import hack is run, the django module is modified in
>  such a way that any submodule that was not imported before can no longer
> be imported.
>
> For now I solved the problem by creating a djangogateway.py module inside
>  the gateway module, which is a copy of django.py without the import
> hack.
>
> Cheers,
> Bart
> _______________________________________________
> PyAMF dev mailing list - dev@...
> http://lists.pyamf.org/mailman/listinfo/dev
>
>




Re: Module hack in gateways seems to cause some problems

by bart vandendriessche-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Nick,

I just did a fresh install using r498 but the problem still occurs, one way to test against this could be the following:

$ django-admin.py startproject pyamf_test
$ cd pyamf_test
$ python manage.py shell
>>> import django
>>> list = dir(django)
>>> list
['VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__path__', 'conf', 'contrib', 'core', 'db', 'dispatch', 'get_version', 'newforms', 'oldforms', 'utils']
>>> from pyamf.gateway.django import DjangoGateway
>>> import django
>>> new_list = dir(django)
>>> for m in list:
...   if not m in new_list:
...     print m
...
conf
contrib
core
db
dispatch
newforms
oldforms
utils
>>>

As you can see, anything that belongs to the real django module, is no longer available.

Hope this helps you some.

Cheers,
Bart

On Dec 6, 2007 1:27 PM, Nick Joyce <nick@...> wrote:
Hey,

Thanks for this, should be fixed in r498.

Basically the pyamf.gateway.django module name was screwing up further
imports to the real django module.

Let me know how you get on with this. :)

Cheers,

Nick

On Thu, December 6, 2007 11:45 am, bart vandendriessche wrote:

> Hey all,
>
>
> We've been running into some weird problems using the DjangoGateway. The
> symptoms were as follows:
>
> We would start up the django server, check the admin then check the
> amfgateway and things would work fine. However, if we visited a page in
> the admin that we had not visited before, after posting something to the
> gateway, we would get weird import errors.
>
> After some experimenting, it seems like the import hack is the culprit of
>  our problems.
>
> Basically, after the import hack is run, the django module is modified in
>  such a way that any submodule that was not imported before can no longer
> be imported.
>
> For now I solved the problem by creating a djangogateway.py module inside
>  the gateway module, which is a copy of django.py without the import
> hack.
>
> Cheers,
> Bart
> _______________________________________________
> PyAMF dev mailing list - dev@...
> http://lists.pyamf.org/mailman/listinfo/dev
>
>


_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev


Re: Module hack in gateways seems to cause some problems

by Robert Slotboom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Bart,

I noticed this last week and reported it to this list.
I got tremplate errors.

Cheers,

Rob


Op 6-dec-07 om 12:45 heeft bart vandendriessche het volgende geschreven:

> Hey all,
>
> We've been running into some weird problems using the DjangoGateway.
> The symptoms were as follows:
>
> We would start up the django server, check the admin then check the
> amfgateway and things would work fine. However, if we visited a page
> in the admin that we had not visited before, after posting something
> to the gateway, we would get weird import errors.
>
> After some experimenting, it seems like the import hack is the culprit
> of our problems.
>
> Basically, after the import hack is run, the django module is modified
> in such a way that any submodule that was not imported before can no
> longer be imported.
>
> For now I solved the problem by creating a djangogateway.py module
> inside the gateway module, which is a copy of django.py without the
> import hack.
>
> Cheers,
> Bart
> _______________________________________________
> PyAMF dev mailing list - dev@...
> http://lists.pyamf.org/mailman/listinfo/dev




Re: Module hack in gateways seems to cause some problems

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

we decided to get rid of those hacks in one of the next revisions,  
see http://pyamf.org/ticket/115

Thijs

On Dec 6, 2007, at 5:13 PM, Robert Slotboom wrote:

> Hi Bart,
>
> I noticed this last week and reported it to this list.
> I got tremplate errors.
>
> Cheers,
>
> Rob
>
>
> Op 6-dec-07 om 12:45 heeft bart vandendriessche het volgende  
> geschreven:
>
>> Hey all,
>>
>> We've been running into some weird problems using the  
>> DjangoGateway. The symptoms were as follows:
>>
>> We would start up the django server, check the admin then check  
>> the amfgateway and things would work fine. However, if we visited  
>> a page in the admin that we had not visited before, after posting  
>> something to the gateway, we would get weird import errors.
>>
>> After some experimenting, it seems like the import hack is the  
>> culprit of our problems.
>>
>> Basically, after the import hack is run, the django module is  
>> modified in such a way that any submodule that was not imported  
>> before can no longer be imported.
>>
>> For now I solved the problem by creating a djangogateway.py module  
>> inside the gateway module, which is a copy of django.py without  
>> the import hack.
>>
>> Cheers,
>> Bart
>> _______________________________________________
>> PyAMF dev mailing list - dev@...
>> http://lists.pyamf.org/mailman/listinfo/dev
>
>
> _______________________________________________
> PyAMF dev mailing list - dev@...
> http://lists.pyamf.org/mailman/listinfo/dev



Re: Module hack in gateways seems to cause some problems

by bart vandendriessche-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I agree that that is probably for the best. Small name suggestion:

djangogateway.py
twistedgateway.py
wsgigateway.py

It's consistant :)

Cheers,
Bart

On Dec 6, 2007 5:14 PM, Thijs Triemstra | Collab < lists@...> wrote:
Hi,

we decided to get rid of those hacks in one of the next revisions,
see http://pyamf.org/ticket/115

Thijs

On Dec 6, 2007, at 5:13 PM, Robert Slotboom wrote:

> Hi Bart,
>
> I noticed this last week and reported it to this list.
> I got tremplate errors.
>
> Cheers,
>
> Rob
>
>
> Op 6-dec-07 om 12:45 heeft bart vandendriessche het volgende
> geschreven:
>
>> Hey all,
>>
>> We've been running into some weird problems using the
>> DjangoGateway. The symptoms were as follows:
>>
>> We would start up the django server, check the admin then check
>> the amfgateway and things would work fine. However, if we visited
>> a page in the admin that we had not visited before, after posting
>> something to the gateway, we would get weird import errors.
>>
>> After some experimenting, it seems like the import hack is the
>> culprit of our problems.
>>
>> Basically, after the import hack is run, the django module is
>> modified in such a way that any submodule that was not imported
>> before can no longer be imported.
>>
>> For now I solved the problem by creating a djangogateway.py module
>> inside the gateway module, which is a copy of django.py without
>> the import hack.
>>
>> Cheers,
>> Bart
>> _______________________________________________
>> PyAMF dev mailing list - dev@...
>> http://lists.pyamf.org/mailman/listinfo/dev
>
>
> _______________________________________________
> PyAMF dev mailing list - dev@...
> http://lists.pyamf.org/mailman/listinfo/dev

_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev


Re: Module hack in gateways seems to cause some problems

by Arnar Birgisson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Dec 6, 2007 4:40 PM, bart vandendriessche
<bart.vandendriessche@...> wrote:
> I agree that that is probably for the best. Small name suggestion:
>
> djangogateway.py
> twistedgateway.py
> wsgigateway.py
>
> It's consistant :)

I agree with Bart on this one. It's more transparent and people are
more likely to "guess" the name djangogateway if they know
twistedgateway, rather than djangoproject. I find myself guessing
stuff all the time because I can't remember them and it's easier to
guess than look it up.

Too bad we won't be able to use Py3k's absolute/relative imports for some years.

Arnar


Re: Module hack in gateways seems to cause some problems

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

fyi: module hack was removed in r501, please give it another try.

Thijs

On Dec 6, 2007, at 5:51 PM, Arnar Birgisson wrote:

> On Dec 6, 2007 4:40 PM, bart vandendriessche
> <bart.vandendriessche@...> wrote:
>> I agree that that is probably for the best. Small name suggestion:
>>
>> djangogateway.py
>> twistedgateway.py
>> wsgigateway.py
>>
>> It's consistant :)
>
> I agree with Bart on this one. It's more transparent and people are
> more likely to "guess" the name djangogateway if they know
> twistedgateway, rather than djangoproject. I find myself guessing
> stuff all the time because I can't remember them and it's easier to
> guess than look it up.
>
> Too bad we won't be able to use Py3k's absolute/relative imports  
> for some years.
>
> Arnar
> _______________________________________________
> PyAMF dev mailing list - dev@...
> http://lists.pyamf.org/mailman/listinfo/dev



Re: Module hack in gateways seems to cause some problems

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

So now we have 'pyamf.gateway.twistedgateway.TwistedGateway'

What about getting rid of the Twisted in TwistedGateway?

Thijs

On Dec 6, 2007, at 10:05 PM, Thijs Triemstra | Collab wrote:

fyi: module hack was removed in r501, please give it another try.

Thijs

On Dec 6, 2007, at 5:51 PM, Arnar Birgisson wrote:

On Dec 6, 2007 4:40 PM, bart vandendriessche
I agree that that is probably for the best. Small name suggestion:

djangogateway.py
twistedgateway.py
wsgigateway.py

It's consistant :)

I agree with Bart on this one. It's more transparent and people are
more likely to "guess" the name djangogateway if they know
twistedgateway, rather than djangoproject. I find myself guessing
stuff all the time because I can't remember them and it's easier to
guess than look it up.

Too bad we won't be able to use Py3k's absolute/relative imports for some years.

Arnar
_______________________________________________
PyAMF dev mailing list - dev@...

_______________________________________________
PyAMF dev mailing list - dev@...


Re: Module hack in gateways seems to cause some problems

by Arnar Birgisson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Dec 6, 2007 9:10 PM, Thijs Triemstra | Collab <lists@...> wrote:
>  So now we have 'pyamf.gateway.twistedgateway.TwistedGateway'
>
> What about getting rid of the Twisted in TwistedGateway?

I don't know, not too sure about that.

from.gateway.twistedgateway import Gateway ?

Arnar


Re: Module hack in gateways seems to cause some problems

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Another suggestion was:

from pyamf.remoting.twistedgateway import Gateway

and getting rid of the gateway package. what do you think?

Thijs

ps. im setting up a users mailinglist atm so we can email about this  
stuff on this dev-list without bothering users, except people that  
are interested in it ;)

On Dec 6, 2007, at 11:58 PM, Arnar Birgisson wrote:

> On Dec 6, 2007 9:10 PM, Thijs Triemstra | Collab <lists@...>  
> wrote:
>>  So now we have 'pyamf.gateway.twistedgateway.TwistedGateway'
>>
>> What about getting rid of the Twisted in TwistedGateway?
>
> I don't know, not too sure about that.
>
> from.gateway.twistedgateway import Gateway ?
>
> Arnar
> _______________________________________________
> PyAMF dev mailing list - dev@...
> http://lists.pyamf.org/mailman/listinfo/dev



Re: Module hack in gateways seems to cause some problems

by Arnar Birgisson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Dec 6, 2007 11:05 PM, Thijs Triemstra | Collab <lists@...> wrote:
> Another suggestion was:
>
> from pyamf.remoting.twistedgateway import Gateway
>
> and getting rid of the gateway package. what do you think?

Yes, that sounds very logical to me. When writing examples I often
(like 5 times or so) wrote "pyamf.remoting.twistedgateway"
subconciously, just to get an import error. :)

I'd keep the "Twisted" in the class name though.

from pyamf.remoting.twistedgateway import TwistedGateway

Can't explain why, just a feeling.

Arnar


Re: Module hack in gateways seems to cause some problems

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Allright -> http://pyamf.org/ticket/116

Thijs

On Dec 7, 2007, at 12:14 AM, Arnar Birgisson wrote:

> On Dec 6, 2007 11:05 PM, Thijs Triemstra | Collab <lists@...>  
> wrote:
>> Another suggestion was:
>>
>> from pyamf.remoting.twistedgateway import Gateway
>>
>> and getting rid of the gateway package. what do you think?
>
> Yes, that sounds very logical to me. When writing examples I often
> (like 5 times or so) wrote "pyamf.remoting.twistedgateway"
> subconciously, just to get an import error. :)
>
> I'd keep the "Twisted" in the class name though.
>
> from pyamf.remoting.twistedgateway import TwistedGateway
>
> Can't explain why, just a feeling.
>
> Arnar
> _______________________________________________
> PyAMF dev mailing list - dev@...
> http://lists.pyamf.org/mailman/listinfo/dev



Re: Module hack in gateways seems to cause some problems

by Nick Joyce :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I haven't been happy with the outcome of this discussion for a while, so I took a second stab at the problem.

I've committed a fix in r692 that reintroduces the import hack (albeit modified) so that we can do things like:

from pyamf.remoting.gateway.django import DjangoGateway

All tests pass and I have also thrashed the tutorial based Django installation along with a PyAMF gateway and haven't come up any problems that were being described in previous posts to this list.

Check it out! If its stable, we'll include it permanently.

Cheers,

Nick

On Fri, 2007-12-07 at 00:36 +0100, Thijs Triemstra | Collab wrote:
Allright -> http://pyamf.org/ticket/116

Thijs

On Dec 7, 2007, at 12:14 AM, Arnar Birgisson wrote:

> On Dec 6, 2007 11:05 PM, Thijs Triemstra | Collab <lists@...>  
> wrote:
>> Another suggestion was:
>>
>> from pyamf.remoting.twistedgateway import Gateway
>>
>> and getting rid of the gateway package. what do you think?
>
> Yes, that sounds very logical to me. When writing examples I often
> (like 5 times or so) wrote "pyamf.remoting.twistedgateway"
> subconciously, just to get an import error. :)
>
> I'd keep the "Twisted" in the class name though.
>
> from pyamf.remoting.twistedgateway import TwistedGateway
>
> Can't explain why, just a feeling.
>
> Arnar
> _______________________________________________
> PyAMF dev mailing list - dev@...
> http://lists.pyamf.org/mailman/listinfo/dev

_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev

Re: Module hack in gateways seems to cause some problems

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Nick,

I updated pyamf for collab.nl but it broke the gateway, although I'm not sure if it's related to r692. SeeĀ http://pyamf.org/ticket/118#comment:5 for the error message, looks like the services can't be found anymore.

Thijs

On Dec 22, 2007, at 10:30 PM, Nick Joyce wrote:

I haven't been happy with the outcome of this discussion for a while, so I took a second stab at the problem.

I've committed a fix in r692 that reintroduces the import hack (albeit modified) so that we can do things like:

from pyamf.remoting.gateway.django import DjangoGateway

All tests pass and I have also thrashed the tutorial based Django installation along with a PyAMF gateway and haven't come up any problems that were being described in previous posts to this list.

Check it out! If its stable, we'll include it permanently.

Cheers,

Nick

On Fri, 2007-12-07 at 00:36 +0100, Thijs Triemstra | Collab wrote:
Allright -> http://pyamf.org/ticket/116

Thijs

On Dec 7, 2007, at 12:14 AM, Arnar Birgisson wrote:

> On Dec 6, 2007 11:05 PM, Thijs Triemstra | Collab <lists@...>  
> wrote:
>> Another suggestion was:
>>
>> from pyamf.remoting.twistedgateway import Gateway
>>
>> and getting rid of the gateway package. what do you think?
>
> Yes, that sounds very logical to me. When writing examples I often
> (like 5 times or so) wrote "pyamf.remoting.twistedgateway"
> subconciously, just to get an import error. :)
>
> I'd keep the "Twisted" in the class name though.
>
> from pyamf.remoting.twistedgateway import TwistedGateway
>
> Can't explain why, just a feeling.
>
> Arnar
> _______________________________________________
> PyAMF dev mailing list - dev@...
> http://lists.pyamf.org/mailman/listinfo/dev

_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev
_______________________________________________
PyAMF dev mailing list - dev@...


Re: Module hack in gateways seems to cause some problems

by Nick Joyce :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The collab site doesn't use the import hack so this isn't related. I'll check the source to see whats going on.

Cheers,

Nick

On Sun, 2007-12-23 at 17:34 +0100, Thijs Triemstra | Collab wrote:
Hi Nick,


I updated pyamf for collab.nl but it broke the gateway, although I'm not sure if it's related to r692. See http://pyamf.org/ticket/118#comment:5 for the error message, looks like the services can't be found anymore.


Thijs

On Dec 22, 2007, at 10:30 PM, Nick Joyce wrote:

I haven't been happy with the outcome of this discussion for a while, so I took a second stab at the problem.

I've committed a fix in r692 that reintroduces the import hack (albeit modified) so that we can do things like:

from pyamf.remoting.gateway.django import DjangoGateway

All tests pass and I have also thrashed the tutorial based Django installation along with a PyAMF gateway and haven't come up any problems that were being described in previous posts to this list.

Check it out! If its stable, we'll include it permanently.

Cheers,

Nick

On Fri, 2007-12-07 at 00:36 +0100, Thijs Triemstra | Collab wrote:
Allright -> http://pyamf.org/ticket/116

Thijs

On Dec 7, 2007, at 12:14 AM, Arnar Birgisson wrote:

> On Dec 6, 2007 11:05 PM, Thijs Triemstra | Collab <lists@...>  
> wrote:
>> Another suggestion was:
>>
>> from pyamf.remoting.twistedgateway import Gateway
>>
>> and getting rid of the gateway package. what do you think?
>
> Yes, that sounds very logical to me. When writing examples I often
> (like 5 times or so) wrote "pyamf.remoting.twistedgateway"
> subconciously, just to get an import error. :)
>
> I'd keep the "Twisted" in the class name though.
>
> from pyamf.remoting.twistedgateway import TwistedGateway
>
> Can't explain why, just a feeling.
>
> Arnar
> _______________________________________________
> PyAMF dev mailing list - dev@...
> http://lists.pyamf.org/mailman/listinfo/dev

_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev
_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev


_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev

Re: Module hack in gateways seems to cause some problems

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Nick,

after some testing I discovered that r693 (some python 2.3 cleanups) breaks pyamf, everything's working fine with the new import hack (r692).

Cheers,

Thijs

On Dec 23, 2007, at 10:17 PM, Nick Joyce wrote:

The collab site doesn't use the import hack so this isn't related. I'll check the source to see whats going on.

Cheers,

Nick

On Sun, 2007-12-23 at 17:34 +0100, Thijs Triemstra | Collab wrote:
Hi Nick,


I updated pyamf for collab.nl but it broke the gateway, although I'm not sure if it's related to r692. SeeĀ http://pyamf.org/ticket/118#comment:5 for the error message, looks like the services can't be found anymore.


Thijs

On Dec 22, 2007, at 10:30 PM, Nick Joyce wrote:

I haven't been happy with the outcome of this discussion for a while, so I took a second stab at the problem.

I've committed a fix in r692 that reintroduces the import hack (albeit modified) so that we can do things like:

from pyamf.remoting.gateway.django import DjangoGateway

All tests pass and I have also thrashed the tutorial based Django installation along with a PyAMF gateway and haven't come up any problems that were being described in previous posts to this list.

Check it out! If its stable, we'll include it permanently.

Cheers,

Nick

On Fri, 2007-12-07 at 00:36 +0100, Thijs Triemstra | Collab wrote:
Allright -> http://pyamf.org/ticket/116

Thijs

On Dec 7, 2007, at 12:14 AM, Arnar Birgisson wrote:

> On Dec 6, 2007 11:05 PM, Thijs Triemstra | Collab <lists@...>  
> wrote:
>> Another suggestion was:
>>
>> from pyamf.remoting.twistedgateway import Gateway
>>
>> and getting rid of the gateway package. what do you think?
>
> Yes, that sounds very logical to me. When writing examples I often
> (like 5 times or so) wrote "pyamf.remoting.twistedgateway"
> subconciously, just to get an import error. :)
>
> I'd keep the "Twisted" in the class name though.
>
> from pyamf.remoting.twistedgateway import TwistedGateway
>
> Can't explain why, just a feeling.
>
> Arnar
> _______________________________________________
> PyAMF dev mailing list - dev@...
> http://lists.pyamf.org/mailman/listinfo/dev

_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev
_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev


_______________________________________________
PyAMF dev mailing list - dev@...
http://lists.pyamf.org/mailman/listinfo/dev
_______________________________________________
PyAMF dev mailing list - dev@...