SourceForge has been redesigned. Learn more.
Close

#9 [Python OFC] Fix for the graph_object.render method

version-1
open
nobody
Helpers (11)
5
2008-06-11
2008-02-27
No

Hi all,

graph_object.render method does not encode the data_url properly, so if you try to call it like this :

g = graph_object()
g.render(500,500,"getData?p_service="+p_service+"&p_format=pie",root))

only the first paramter is took into account, the last one is lost in the rendered html code

[code]
<param name="movie" value="scripts/open-flash-chart.swf?width=500&height=500&data=getData%?p_service=domaine&p_format=bar" />
<embed src="scripts/open-flash-chart.swf?width=500&height=500&data=getData%?p_service=domaine&p_format=bar" ... />
[/code]
As you can see, your parameters are lost because they are passed as parameters for open-flash-chart.swf instead.

To fix this, one must use urllib.quote(data_url) to have the proper html rendering :

[code]
<param name="movie" value="scripts/open-flash-chart.swf?width=500&height=500&data=getData%3Fp_service%3Ddomaine%26p_format%3Dbar" />
<embed src="scripts/open-flash-chart.swf?width=500&height=500&data=getData%3Fp_service%3Ddomaine%26p_format%3Dbar"
[/code]

ChangeLog

2008-02-27 Chaouche yassine <yacinechaouche@yahoo.com>

* OpenFlashChart.py :
(graph_object.render):
Wrapped the data_url into urllib.quote() so that it wont be interpreted as a parameter to the swf object;

Related

Code: code

Discussion

  • Yacine Chaouche

    Yacine Chaouche - 2008-02-27

    Patch for graph.render method

     
  • John Vandervort

    John Vandervort - 2008-06-11
    • labels: --> Helpers
     
  • John Vandervort

    John Vandervort - 2008-06-11
    • milestone: --> version-1
     

Log in to post a comment.