Merge lp:~diegosarmentero/ubuntuone-client/udf-issue into lp:ubuntuone-client

Proposed by Diego Sarmentero
Status: Merged
Approved by: Natalia Bidart
Approved revision: 1184
Merged at revision: 1184
Proposed branch: lp:~diegosarmentero/ubuntuone-client/udf-issue
Merge into: lp:ubuntuone-client
Diff against target: 54 lines (+16/-3)
3 files modified
tests/syncdaemon/test_vm_helper.py (+15/-0)
ubuntuone/platform/__init__.py (+0/-1)
ubuntuone/syncdaemon/vm_helper.py (+1/-2)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-client/udf-issue
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Brian Curtin (community) Approve
Review via email: mp+90208@code.launchpad.net

Commit message

Fixed: Problem trying to create an udf with unicode username (LP: #921703 ).

To post a comment you must log in.
1183. By Diego Sarmentero

Adding missing docstring

1184. By Diego Sarmentero

Fixed unicode automatic promotion

Revision history for this message
Brian Curtin (brian.curtin) wrote :

+1

review: Approve
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks and works great!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/syncdaemon/test_vm_helper.py'
2--- tests/syncdaemon/test_vm_helper.py 2012-01-04 13:18:50 +0000
3+++ tests/syncdaemon/test_vm_helper.py 2012-01-25 21:09:23 +0000
4@@ -66,6 +66,21 @@
5 in_home = os.path.join(self.home_dir, 'foo')
6 self.assertEqual(u'~/foo', get_udf_suggested_path(in_home))
7
8+ def test_get_udf_suggested_path_expand_user_decode(self):
9+ """Test for get_udf_suggested_path."""
10+ home = os.path.join(self.home_dir.decode('utf-8'),
11+ u'雄鳥お人好し ñandú')
12+
13+ def fake_expand_user(path):
14+ """Fake expand_user."""
15+ return home.encode('utf-8')
16+
17+ self.patch(vm_helper, 'expand_user', fake_expand_user)
18+ in_home = os.path.join(home, u'ñoño')
19+ in_home = in_home.encode('utf-8')
20+ suggested_path = get_udf_suggested_path(in_home)
21+ self.assertEqual(u'~/ñoño', suggested_path)
22+
23 def test_get_udf_suggested_path_long_path(self):
24 """Test for get_udf_suggested_path."""
25 deep_in_home = os.path.join(self.home_dir, 'docs', 'foo', 'bar')
26
27=== modified file 'ubuntuone/platform/__init__.py'
28--- ubuntuone/platform/__init__.py 2011-12-08 20:56:10 +0000
29+++ ubuntuone/platform/__init__.py 2012-01-25 21:09:23 +0000
30@@ -37,7 +37,6 @@
31
32 def expand_user(path):
33 """Fix Python expanduser for weird chars in windows."""
34- # Receives bytes, returns unicode
35 assert isinstance(path, str)
36 try:
37 path.decode('utf-8')
38
39=== modified file 'ubuntuone/syncdaemon/vm_helper.py'
40--- ubuntuone/syncdaemon/vm_helper.py 2011-11-17 18:38:41 +0000
41+++ ubuntuone/syncdaemon/vm_helper.py 2012-01-25 21:09:23 +0000
42@@ -89,12 +89,11 @@
43 """
44 if not path:
45 raise ValueError("no path specified")
46-
47 assert isinstance(path, str)
48
49 path = path.decode('utf8')
50
51- user_home = expand_user('~')
52+ user_home = expand_user('~').decode('utf-8')
53 start_list = os.path.abspath(user_home).split(os.path.sep)
54 path_list = os.path.abspath(path).split(os.path.sep)
55

Subscribers

People subscribed via source and target branches