ehsanf / pygvoicelib

Automatically exported from code.google.com/p/pygvoicelib
0 stars 0 forks source link

[FIX] rnr_se initilization bug #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create a GoogleVoice object with user and password but without auth_token 
and rnr_se
2. Invoke call() method

What is the expected output? What do you see instead?

Expect call to go through but get 500 "Internal Server Error" response instead.

What version of the product are you using? On what operating system?

This is for version 1.0 running on Windows.

Please provide any additional information below.

Debugging this I noticed that call() was calling get_auth_url() with data 
including rnr_se, however for the first call rnr_se is not yet set when call() 
uses it to create the data param. get_auth_url then sets self.rnr_se, but the 
stale copy (which is None) is still in data. This can be fixed in 
_get_url_data() by changing:

    data = urllib.urlencode(data)

to:

    if data and '_rnr_se' in data and not data['_rnr_se'] and self.rnr_se:
        data['_rnr_se'] = self.rnr_se
    data = urllib.urlencode(data)

Here's the diff (.diff file also attached):

--- pygvoicelib.py      2013-03-01 01:18:04.388757700 -0800
+++ pygvoicelib.rnrfix.py       2013-03-01 14:34:01.288750000 -0800
@@ -95,6 +95,8 @@
         if header:
             req_header = req_header.copy()
             req_header.update(header)
+        if data and '_rnr_se' in data and not data['_rnr_se'] and self.rnr_se:
+            data['_rnr_se'] = self.rnr_se
         data = urllib.urlencode(data)
         if data == '':
             data = None

Original issue reported on code.google.com by jimhark@gmail.com on 1 Mar 2013 at 10:40

Attachments: