dcorking / google-wave-resources

Automatically exported from code.google.com/p/google-wave-resources
0 stars 0 forks source link

[python] proxy_for does not work with fetch_wavelet if 'proxy user' is not already participant of the wave #854

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The problem is that the proxy user is not automatically added to the wave.

myRobot.fetch_wavelet("SomeWaveId", None, "proxyid") # does not work if the 
proxy user is not already participant of SomeWaveId.

RpcError: 500: internalError: somebot+proxyid@appspot.com is not a participant 
of wave id: [WaveId SomeWaveId] wavelet id: [WaveletId 
googlewave.com!conv+root]. Unable to apply operation: 
{'method':'robot.fetchWave','id':'3007122','waveId':'SomeWaveId','waveletId':'go
oglewave.com!conv+root','blipId':'null','parameters':{PROXYING_FOR=proxyid}}

But the following works:

wavelet = myRobot.fetch_wavelet("SomeWaveId")
wavelet.robot_address = "somebot@appspot.com"
wavelet.proxy_for("proxyid")

I think the problem is waveservice.py (Revision 36)
398 util.check_is_valid_proxy_for_id(proxy_for_id)
399 if not wavelet_id:

Here the validity of proxy_for_id is checked but no participant is added to the 
wave.

In wavelet.py the participant is added after the validity is checked:

374 util.check_is_valid_proxy_for_id(proxy_for_id)
375 self.add_proxying_participant(proxy_for_id)

Original issue reported on code.google.com by lehrg...@gmail.com on 19 Jul 2010 at 10:02

GoogleCodeExporter commented 8 years ago
I'm not sure you can call this a bug... If x participant is not part of a wave, 
why should they be able to fetch it?

Simple solution: Add the proxy first, then call submit(wavelet), then call 
fetch_wavelet for the proxy.

Original comment by nat.abbo...@gmail.com on 28 Jul 2010 at 8:37

GoogleCodeExporter commented 8 years ago
Yes, I could do that, but I think that the proxy_for parameter in fetch_wavelet 
would be more or less useless.

With this method I have to:
1. fetch the wavelet
2. add the participant
3. submit the wavelet
5. fetch it again with the proxy_id

Where I could use the following method:
1. fetch the wavelet
2. add the robot address to the wavelet
3. use wavelet.proxy_for

Or even better:
1. fetch the wavelet with the proxy_id ... and done

In my opinion myRobot.fetch_wavelet("SomeWaveId", None, "proxyid") is just a 
shortcut for the last method.

If I first have to fetch the wavelet and add the participant, why should I use 
fetch_wavelet with a proxy at all and not just use the method with 
wavelet.proxy_for?

I think fetch_wavelet should work the same way as wavelet.proxy_for. Why should 
I need to add the proxy participant if I use fetch_wavelet but not if I use 
wavelet.proxy_for?

Does anybody know how this works in the Java API?

Original comment by lehrg...@gmail.com on 28 Jul 2010 at 9:49

GoogleCodeExporter commented 8 years ago
Also - this isn't necessary at all - you can actually do what you want already.

Simply add the proxy to the wavelet and then call wavelet.proxyFor('proxyid')
where 'proxyid' only the part between the + & the @ in the following 
robot+proxyid@appspot.com

Original comment by nat.abbo...@gmail.com on 28 Jul 2010 at 1:03

GoogleCodeExporter commented 8 years ago
I can even do that _without_ adding the proxy to the wavelet first! And that is 
where the fetch_wavelet API has a bug or is at least inconsistent with the rest 
of the API.

What I am doing at the moment ist:
1. fetch_wavelet without proxy id
2. add robot address to wavelet
3. call proxy_for on the wavelet with the proxy_id (-> no need to add the proxy 
id to the wavelet before that! It just adds it _automatically_.)

What I want is:
1. fetch_wavelet with proxy id (_without_ adding the participant prior to this 
_manually_, why else would I use fetch wavelet with the proxy_id?)

Original comment by lehrg...@gmail.com on 28 Jul 2010 at 1:58

GoogleCodeExporter commented 8 years ago
But fetch_wavelet gets you a copy of the wavelet from x-proxy's point of view. 
If x-proxy isn't on the wavelet, it has no point of view, so you get an error. 
So why can't you just fetch_wavelet w/o proxy, then call proxy for on the 
wavelet? What you are trying to do defies the nature of wave IMHO.

Original comment by nat.abbo...@gmail.com on 28 Jul 2010 at 4:05

GoogleCodeExporter commented 8 years ago
Sure I can do it this way, but why has fetch_wavelet a proxy_for param if it is 
more or less useless?

At the moment if I ever want to use the fetch_wavelet with a proxy_id a have to 
fetch the wavelet first without a proxy id to add the proxy user to it or check 
if the proxy user is already a participant of the wavelet.

And if this defies the nature of wave than the method with wavelet.proxy_for 
defies it too, because the proxy user is added automatically. 

IMO both methods should behave the same and the documentation should be clear 
about what the prerequisites of this functions are (for example a already added 
participant) or state that the participant will be added automatically.

Original comment by lehrg...@gmail.com on 28 Jul 2010 at 4:40

GoogleCodeExporter commented 8 years ago
Fetch wavelet has a proxy for parameter so that you can fetch a wavelet on 
behalf of a proxy that is on that wave.

Original comment by nat.abbo...@gmail.com on 28 Jul 2010 at 5:35

GoogleCodeExporter commented 8 years ago
OK, but how should a programmer know if a proxy_id (just some kind of a string) 
is on the wavelet or not? To figure this out a programmer has to fetch the 
wavelet and check the list of participants or maintain a list of participant 
outside of wave...

I sill think this is a bug. Especially since you do not need to manually add 
the proxy participant with wavelet.proxy_for.

How does fetchWavelet and wavelet.proxyFor works in the Java API?

Original comment by lehrg...@gmail.com on 28 Jul 2010 at 7:36