[trunk] hr and photo.png
Bug #666475 reported by
Claude Petit
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The hr addon reads a file named "photo.png" from "addons_path" configuration setting. But this setting can have multiple paths, separated by a comma. In this case, the function "_get_photo" crashes the server.
/addons/hr/hr.py
Line 186:
- return open(os.path.join(
- tools.config[
- 'rb') .read()
+ paths = tools.config[
+ for path in paths:
+ filename = os.path.join(path, 'hr/image', 'photo.png')
+ if os.path.
+ return open(filename, 'rb').read(
+ return None
NOTE: I have a problem with spaces in the editor
description: | updated |
description: | updated |
tags: | added: hr |
Changed in openobject-addons: | |
status: | New → Fix Released |
Changed in openobject-addons: | |
milestone: | none → 6.0-rc2 |
To post a comment you must log in.
On Monday 25 October 2010, you wrote: 'addons_ path'], 'hr/image', 'photo.png'), .encode( 'base64' ) 'addons_ path']. split(' ,') isfile( filename) : ).encode( 'base64' )
> Public bug reported:
>
> The hr addon reads a file named "photo.png" from "addons_path"
> configuration setting. But this setting can have multiple paths,
> separated by a comma. In this case, the function "_get_photo" crashes
> the server.
>
> /addons/hr/hr.py
>
> Line 186:
> + - return open(os.path.join(
> + - tools.config[
> + - 'rb') .read()
> + + paths = tools.config[
> + + for path in paths:
> + + filename = os.path.join(path, 'hr/image', 'photo.png')
> + + if os.path.
> + + return open(filename, 'rb').read(
> + + return None
> +
This code is not optimal, either. resource( )" that you should use. Never access 'addons_ path'] directly.
There is a "get_module_
config[