[Sugar-devel] [PATCH Browse] Error page SL #3500

Manuel Quiñones manuq at laptop.org
Tue Sep 18 13:44:22 EDT 2012


2012/9/18 Samuel Greenfeld <greenfeld at laptop.org>:
> +DEFAULT_ERROR_PAGE = os.path.join(activity.get_bundle_path(),
> +                                  'data/error_page.html')
> {...}
>
> +        f = open(DEFAULT_ERROR_PAGE, 'w')
> +        f.write(html)
> +        f.close()
>
> activity.get_bundle_path() resolves to the directory the Activity is
> installed in, which is not guaranteed to be writable.

We are safe writting to 'data' or 'tmp' directories in the activity root:

http://wiki.sugarlabs.org/go/Development_Team/Almanac/sugar.activity.activity#How_do_I_get_the_file_path_where_I_can_write_files_programmatically.3F

For example Browse stores a sqlite database in 'data' for the
autocompletion in the URL/title entry (places.py in Browse).

-- 
.. manuq ..


More information about the Sugar-devel mailing list