Merge lp:~nataliabidart/ubuntuone-control-panel/default-folders into lp:ubuntuone-control-panel
| Status: | Merged |
|---|---|
| Approved by: | Natalia Bidart on 2012-03-16 |
| Approved revision: | 290 |
| Merged at revision: | 287 |
| Proposed branch: | lp:~nataliabidart/ubuntuone-control-panel/default-folders |
| Merge into: | lp:ubuntuone-control-panel |
| Diff against target: |
339 lines (+235/-8) 6 files modified
ubuntuone/controlpanel/logger.py (+2/-4) ubuntuone/controlpanel/utils/__init__.py (+5/-2) ubuntuone/controlpanel/utils/linux.py (+59/-0) ubuntuone/controlpanel/utils/tests/test_linux.py (+101/-1) ubuntuone/controlpanel/utils/tests/test_windows.py (+41/-0) ubuntuone/controlpanel/utils/windows.py (+27/-1) |
| To merge this branch: | bzr merge lp:~nataliabidart/ubuntuone-control-panel/default-folders |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| dobey (community) | Approve on 2012-03-16 | ||
| Diego Sarmentero (community) | Approve on 2012-03-16 | ||
| Brian Curtin (community) | 2012-03-16 | Approve on 2012-03-16 | |
|
Review via email:
|
|||
Commit Message
- Implemented a method to list the user's default folders in every platform (part of LP: #933697).
| Natalia Bidart (nataliabidart) wrote : | # |
> 94 + with open(dirs_path) as f:
> 95 + while True:
> 96 + line = f.readline()
>
> The file object you get back (f) is already iterable, so you could replace the
> "while True" with "for line in f"
>
> Other than this it looks alright.
Fixed and pushed, great catch! thanks
- 289. By Natalia Bidart on 2012-03-16
-
- Inprove default_folders file content iteration (thanks brian.curtin).
| dobey (dobey) wrote : | # |
86 + if dirs_path is None:
87 + dirs_path = os.path.
We probably want to use xdg_config_home from dirspec.basedir here, instead of assuming ~/.config/.
With the suggestion from Brian, you can also drop the if line is None: break check.
Do we need to check that translated names for directories get handled correctly as well here, and ensure that unicode handling doesn't break again? I don't see a test for that case in your tests.
Also, on Windows, for the special folders you check for, which aren't supported on XP for example, how is that error handled? I suppose there should be a test which causes and checks for the error when that happens, to ensure we handle it properly? The linked MSDN page seems to suggest that _MYVIDEO doesn't exist on 5.0 (XP) for example. It might also be worth noting in the comment that if/when we drop XP support, we probably want to switch to _MYDOCUMENTS instead of _PERSONAL for that folder; as the documentation seems to suggest we should do.
| Natalia Bidart (nataliabidart) wrote : | # |
> 86 + if dirs_path is None:
> 87 + dirs_path = os.path.
>
> We probably want to use xdg_config_home from dirspec.basedir here, instead of
> assuming ~/.config/.
Added.
> With the suggestion from Brian, you can also drop the if line is None: break
> check.
Done already.
> Do we need to check that translated names for directories get handled
> correctly as well here, and ensure that unicode handling doesn't break again?
> I don't see a test for that case in your tests.
Added tests for this.
> Also, on Windows, for the special folders you check for, which aren't
> supported on XP for example, how is that error handled? I suppose there should
> be a test which causes and checks for the error when that happens, to ensure
> we handle it properly? The linked MSDN page seems to suggest that _MYVIDEO
> doesn't exist on 5.0 (XP) for example. It might also be worth noting in the
> comment that if/when we drop XP support, we probably want to switch to
> _MYDOCUMENTS instead of _PERSONAL for that folder; as the documentation seems
> to suggest we should do.
Good catch, made the code more robust and added tests for it.
- 290. By Natalia Bidart on 2012-03-16
-
Better unicode management, and non existent folders.


94 + with open(dirs_path) as f:
95 + while True:
96 + line = f.readline()
The file object you get back (f) is already iterable, so you could replace the "while True" with "for line in f"
Other than this it looks alright.