odoo/odoo — pull request #904 by vaab (2014-07-03 14:50:01+00:00)
Title: fix: default ``data_dir`` would be accessed before even ``--data-dir`` option is read.

Parsing of ``--data-dir`` command line argument won't be read before actually trying to create some dir in the default data-dir ``~/.local/share/`` path.

***Impacted versions:***

- All of them since data-dir changes (saas~3 ?, saas~4, saas~5, trunk)

***Steps to reproduce:***

1. Under linux, have an ``openerp`` system user, be ``randomuser`` with sudo perm
2. run ``sudo -u openerp openerp-server [...] --data-dir /tmp/test``

***Current behavior:***

- Server bails out and fails to get up and cast exception:
```
[...]
File "/home/vaab/dev/python/sandbox/default/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/randomuser/.local/share'
```

***Expected behavior:***

- No exception as my specified data-dir was ``/tmp/test``

***Diagnostic and proposed fix***

This is because ``import http`` would do things. And this is bad.

It would instanciate "Root()" which in turns would acces to the config... and patatra.