+DEFAULT_ERROR_PAGE = os.path.join(activity.get_bundle_path(),<br><div>
+                                  'data/error_page.html')<br>
{...}<br>+        f = open(DEFAULT_ERROR_PAGE, 'w')<br>
+        f.write(html)<br>
+        f.close()<br><br>activity.get_bundle_path() resolves to the directory the Activity is installed in, which is not guaranteed to be writable.<br><br>For example: Fedora installs its Sugar activities as RPMs in subdirectories of /usr/share/sugar/activities.  These directories are only readable/writable by root.<br>

<br>Python can make a secure temporary file with the tempfile module, but be aware that newer versions of Python will delete the file on close unless you explicitly say not to.<br>
<br><br>And can we make this page able to retry both GET and POST requests?  We might also have to preserve the HTTP Referrer header in order not to break websites which check it.<br><br>In general I suspect this would be easier to handle within WebKit (if such functionality is available) than by making a custom page external to everything.<br>



</div><br><br><div class="gmail_quote">On Tue, Sep 18, 2012 at 1:00 PM, Manuel Kaufmann <span dir="ltr"><<a href="mailto:humitos@gmail.com" target="_blank">humitos@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div>On Tue, Sep 18, 2012 at 1:55 PM, Manuel Kaufmann <<a href="mailto:humitos@gmail.com" target="_blank">humitos@gmail.com</a>> wrote:<br>
> This patch contains a HTML template (error_page.tmpl) that is used to<br>
> generate the error page with the correct language.<br>
<br>
</div>Please, comments and suggestions are welcomed here. I didn't find an<br>
existent way (inside Sugar) to translate html content, so I decide to<br>
make it by myself.<br>
<br>
I created a file called "error_page.tmpl" that contains the html<br>
structure of the page with some placeholders to put the translated<br>
strings (those placeholders are substituted with the % operator) and a<br>
new html file is create: "error_page.html" with the correct strings<br>
and url to try again. Then, this file is used to tell WekKit to load<br>
that file as an uri:<br>
<div><br>
  self.load_uri('file://' + DEFAULT_ERROR_PAGE)<br>
<br>
</div>That file is generated every time that the web page can't be reached<br>
for any reason.<br>
<br>
See you,<br>
<span><font color="#888888"><br>
--<br>
Kaufmann Manuel<br>
Blog: <a href="http://humitos.wordpress.com/" target="_blank">http://humitos.wordpress.com/</a><br>
Porfolio: <a href="http://fotos.mkaufmann.com.ar/" target="_blank">http://fotos.mkaufmann.com.ar/</a><br>
PyAr: <a href="http://www.python.com.ar/" target="_blank">http://www.python.com.ar/</a><br>
</font></span><div><div>_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</div></div></blockquote></div><br>