← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 666714] [NEW] [6.0rc1] some addons directly access tools.config['addons_path']

 

Public bug reported:

Starting with v6.0 OpenERP supports multiple addons paths. This means that one cannot simply access tools.config['addons_path'] and use it with os.path.join to access a resource file from a module.
OpenERP also support zipped modules, which means that merely doing an os.path.join() will not work to open the file.

Please instead use addons.get_module_resource( ) to obtain the path to the resource (which could be inside a zip file!)
Also make sure to verify the return value of get_module_resource( ), which could be False when the file was not found.

You could also use directly tools.misc.file_open() which will return the
open file even if it is inside a zip (also needs its own error checking)

** Affects: openobject-addons
     Importance: Medium
     Assignee: OpenERP R&D Addons Team 2 (openerp-dev-addons2)
         Status: Confirmed

** Affects: openobject-server
     Importance: Medium
         Status: Invalid

** Changed in: openobject-addons
     Assignee: (unassigned) => OpenERP R&D Addons Team 2 (openerp-dev-addons2)

** Also affects: openobject-server
   Importance: Undecided
       Status: New

** Changed in: openobject-server
   Importance: Undecided => Medium

** Changed in: openobject-server
       Status: New => Confirmed

** Changed in: openobject-server
    Milestone: None => 6.0-rc2

** Changed in: openobject-server
       Status: Confirmed => Invalid

** Description changed:

  Starting with v6.0 OpenERP supports multiple addons paths. This means that one cannot simply access tools.config['addons_path'] and use it with os.path.join to access a resource file from a module.
  OpenERP also support zipped modules, which means that merely doing an os.path.join() will not work to open the file.
  
- Please instead use addons.get_module_resource( ) to obtain the path to the resource.
+ Please instead use addons.get_module_resource( ) to obtain the path to the resource (which could be inside a zip file!)
  Also make sure to verify the return value of get_module_resource( ), which could be False when the file was not found.
  
- For the framework, we also need to fix tools.file_open to properly
- handle this.
+ You could also use directly tools.misc.file_open() which will return the
+ open file even if it is inside a zip (also needs its own error checking)

-- 
[6.0rc1] some addons directly access tools.config['addons_path'] 
https://bugs.launchpad.net/bugs/666714
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Addons Modules: Confirmed
Status in OpenObject Server: Invalid

Bug description:
Starting with v6.0 OpenERP supports multiple addons paths. This means that one cannot simply access tools.config['addons_path'] and use it with os.path.join to access a resource file from a module.
OpenERP also support zipped modules, which means that merely doing an os.path.join() will not work to open the file.

Please instead use addons.get_module_resource( ) to obtain the path to the resource (which could be inside a zip file!)
Also make sure to verify the return value of get_module_resource( ), which could be False when the file was not found.

You could also use directly tools.misc.file_open() which will return the open file even if it is inside a zip (also needs its own error checking)







Follow ups

References