Ticket #534: aliases unicode support.darcspatch

File aliases unicode support.darcspatch, 12.5 KB (added by zooko, at 2009-06-09T19:53:26Z)
Line 
1Mon Apr 27 03:58:07 MDT 2009  francois@ctrlaltdel.ch
2  * cli: aliases unicode support
3
4New patches:
5
6[cli: aliases unicode support
7francois@ctrlaltdel.ch**20090427095807
8 Ignore-this: e2c49f5851ab89819acc633a196cc3df
9] {
10hunk ./src/allmydata/scripts/cli.py 57
11 
12 class AddAliasOptions(VDriveOptions):
13     def parseArgs(self, alias, cap):
14-        self.alias = alias
15+        self.alias = argv_to_unicode(alias)
16         self.cap = cap
17 
18     def getSynopsis(self):
19hunk ./src/allmydata/scripts/cli.py 67
20 
21 class CreateAliasOptions(VDriveOptions):
22     def parseArgs(self, alias):
23-        self.alias = alias
24+        self.alias = argv_to_unicode(alias)
25 
26     def getSynopsis(self):
27         return "%s create-alias ALIAS" % (os.path.basename(sys.argv[0]),)
28hunk ./src/allmydata/scripts/common.py 3
29 
30 import os, sys, urllib
31+import codecs
32 from twisted.python import usage
33 
34 
35hunk ./src/allmydata/scripts/common.py 104
36     except EnvironmentError:
37         pass
38     try:
39-        f = open(aliasfile, "r")
40+        f = codecs.open(aliasfile, "r", "utf-8")
41         for line in f.readlines():
42             line = line.strip()
43             if line.startswith("#") or not line:
44hunk ./src/allmydata/scripts/common.py 111
45                 continue
46             name, cap = line.split(":", 1)
47             # normalize it: remove http: prefix, urldecode
48-            cap = cap.strip()
49+            cap = cap.strip().encode('ascii')
50             aliases[name] = uri.from_string_dirnode(cap).to_string()
51     except EnvironmentError:
52         pass
53hunk ./src/allmydata/scripts/tahoe_add_alias.py 3
54 
55 import os.path
56+import codecs
57+import sys
58 from allmydata import uri
59 from allmydata.scripts.common_http import do_http, check_http_error
60 from allmydata.scripts.common import get_aliases
61hunk ./src/allmydata/scripts/tahoe_add_alias.py 8
62+from allmydata.util.stringutils import unicode_to_stdout
63 
64 def add_alias(options):
65     nodedir = options['node-directory']
66hunk ./src/allmydata/scripts/tahoe_add_alias.py 58
67     new_uri = resp.read().strip()
68 
69     # probably check for others..
70-    f = open(aliasfile, "a")
71+    f = codecs.open(aliasfile, "a", "utf-8")
72     f.write("%s: %s\n" % (alias, new_uri))
73     f.close()
74hunk ./src/allmydata/scripts/tahoe_add_alias.py 61
75-    print >>stdout, "Alias '%s' created" % (alias,)
76+    print >>stdout, "Alias '%s' created" % (unicode_to_stdout(alias),)
77     return 0
78 
79 def list_aliases(options):
80hunk ./src/allmydata/test/test_cli.py 521
81             self._test_webopen(["two:"], self.two_url)
82         d.addCallback(_test_urls)
83 
84+        d.addCallback(lambda res: self.do_cli("create-alias", "études"))
85+        def _check_create_unicode((rc,stdout,stderr)):
86+            self.failUnlessEqual(rc, 0)
87+            self.failIf(stderr)
88+
89+            # If stdout only supports ascii, accentuated characters are
90+            # being replaced by '?'
91+            if sys.stdout.encoding == "ANSI_X3.4-1968":
92+                self.failUnless("Alias '?tudes' created" in stdout)
93+            else:
94+                self.failUnless("Alias 'études' created" in stdout)
95+
96+            aliases = get_aliases(self.get_clientdir())
97+            self.failUnless(aliases[u"études"].startswith("URI:DIR2:"))
98+        d.addCallback(_check_create_unicode)
99+
100+        d.addCallback(lambda res: self.do_cli("ls", "études:"))
101+        def _check_ls1((rc, stdout, stderr)):
102+            self.failUnlessEqual(rc, 0)
103+            self.failIf(stderr)
104+
105+            self.failUnlessEqual(stdout, "")
106+        d.addCallback(_check_ls1)
107+
108+        d.addCallback(lambda res: self.do_cli("put", "-", "études:uploaded.txt",
109+          stdin="Blah blah blah"))
110+
111+        d.addCallback(lambda res: self.do_cli("ls", "études:"))
112+        def _check_ls2((rc, stdout, stderr)):
113+            self.failUnlessEqual(rc, 0)
114+            self.failIf(stderr)
115+
116+            self.failUnlessEqual(stdout, "uploaded.txt\n")
117+        d.addCallback(_check_ls2)
118+
119+        d.addCallback(lambda res: self.do_cli("get", "études:uploaded.txt"))
120+        def _check_get((rc, stdout, stderr)):
121+            self.failUnlessEqual(rc, 0)
122+            self.failIf(stderr)
123+            self.failUnlessEqual(stdout, "Blah blah blah")
124+        d.addCallback(_check_get)
125+
126         return d
127 
128 class Put(GridTestMixin, CLITestMixin, unittest.TestCase):
129}
130
131Context:
132
133[test_cli.Backup: increase timeout massively, it takes 1200s on zandr's ARM linkstation
134warner@lothar.com**20090609052801] 
135[tests: double the timeouts on some tests which time-out on Francois's box
136zooko@zooko.com**20090609021753
137 Ignore-this: b2727b04402f24a9b9123d2f84068106
138] 
139[tests: bump up timeouts so that the tests can finish before timeout on Francois's little arm box
140zooko@zooko.com**20090608225557
141 Ignore-this: fb83698338b2f12546cd3e1dcb896d34
142] 
143[tests: increase timeouts on some other tests that timed-out on Francois's arm box
144zooko@zooko.com**20090605143437
145 Ignore-this: 2903cc20d914fc074c8d7a6c47740ba6
146] 
147[tests: bump up the timeout on a bunch of tests that took longer than the default timeout (120s) on François Lenny-armv5tel
148zooko@zooko.com**20090605031444
149 Ignore-this: 84d67849b1f8edc88bf7001e31b5f7f3
150] 
151[backup: remove the --no-backupdb command, the handling of "can't import sqlite", and the related tests, and change an error message to more correctly indicate failure to load the database from disk rather than failure to import sqlite module
152zooko@zooko.com**20090604173131
153 Ignore-this: 8200a9fdfc49243c280ecd1d0c44fa19
154 Fixes #728.
155] 
156[more refactoring: move get_all_serverids() and get_nickname_for_serverid() from Client to storage_broker
157warner@lothar.com**20090602030750] 
158[more storage_broker refactoring: downloader gets a broker instead of a client,
159warner@lothar.com**20090602022511
160 use Client.get_storage_broker() accessor instead of direct attribute access.
161] 
162[test_runner.py: remove test_client_no_noise: the issue in question is
163warner@lothar.com**20090601225007
164 ticketed in http://divmod.org/trac/ticket/2830 and doesn't need a Tahoe-side
165 change, plus this test fails on win32 for unrelated reasons (and test_client
166 is the place to think about the win32 issue).
167] 
168[remove plaintext-hashing code from the helper interface, to close #722
169warner@lothar.com**20090601224916
170 and deny the Helper the ability to mount a partial-information-guessing
171 attack. This will probably break compatibility between new clients and very
172 old (pre-1.0) helpers.
173] 
174[start to factor server-connection-management into a distinct 'StorageServerFarmBroker' object, separate from the client and the introducer. This is the starting point for #467: static server selection
175warner@lothar.com**20090601210604] 
176[mutable: catch and display first error, so code bugs which break all servers get displayed better
177warner@lothar.com**20090601210407] 
178[misc/run-with-pythonpath.py: exec() the child (on unix), to remove the intermediate process
179warner@lothar.com**20090601210137] 
180[setup: require pysqlite >= v2.0.5. if we are running on Python < 2.5
181zooko@zooko.com**20090604154548
182 Ignore-this: cf04f46079821df209d01dad2e24b40b
183] 
184[setup: add pysqlite and sqlite to get_package_versions()
185zooko@zooko.com**20090604153728
186 Ignore-this: a1dea7fabeab2b08fb0d8d462facdb4d
187] 
188[docs: small edit to about.html
189zooko@zooko.com**20090528233422
190 Ignore-this: 1cfbb1f8426ed6d63b2d3952e4464ddc
191] 
192[docs: add links to Tahoe-LAFS for Paranoids and Tahoe-LAFS for Corporates in about.html
193zooko@zooko.com**20090528232717
194 Ignore-this: 7b70baa700d6b6f6e9ceec4132efe5
195] 
196[docs: edit about.html and include network-and-reliance-topology.png (loaded from http://allmydata.org )
197zooko@zooko.com**20090527150916
198 Ignore-this: 44adc61cde8ced8be2f0a7dfc7d95dad
199] 
200[docs: a few more edits to network-and-reliance-topology.svg
201zooko@zooko.com**20090527150458
202 Ignore-this: 2eac8c33fe71be25ff809b399c6193c1
203] 
204[docs: update NEWS, relnotes.txt, CREDITS to mention WUI Style
205zooko@zooko.com**20090526233654
206 Ignore-this: 72d16ec833bc4a22af23d29ea1d5ff8b
207] 
208[docs: update network-and-reliance-topology.svg for beauty and clarity
209zooko@zooko.com**20090527031123
210 Ignore-this: 5510914849771900ac29b4312470d84
211] 
212[Modify markup of Tahoe web pages to be more amenable to styling; some minor changes of wording.
213Kevin Reid <kpreid@mac.com>**20090526232545
214 Ignore-this: 8845937f0df6c7ddc07abe3211428a6f
215] 
216[Tweak wording in directory page: not-read-only is "modifiable", mention creating a directory _in this directory_.
217Kevin Reid <kpreid@mac.com>**20090526232414
218 Ignore-this: f006ec52ba2051802e025a60bcface56
219] 
220[Comment on duplication of code/markup found during styling project.
221Kevin Reid <kpreid@mac.com>**20090503203442
222 Ignore-this: a4b7f9f0ab57d2c03be9ba761be8d854
223] 
224[Add CSS styles to spiff up the Tahoe WUI's appearance, particularly the welcome page and directories.
225Kevin Reid <kpreid@mac.com>**20090503203142
226 Ignore-this: 5c50af241c1a958b5180ef2b6a49f626
227] 
228[Link all Tahoe web pages to the /tahoe_css stylesheet which already exists.
229Kevin Reid <kpreid@mac.com>**20090503202533
230 Ignore-this: 2ea8d14d3168b9502cf39d5ea3f2f2a8
231] 
232[Fix broken link from Provisioning to Reliability page.
233Kevin Reid <kpreid@mac.com>**20090501191050
234 Ignore-this: 56dc1a5e659b70cc02dc4df7b5d518cd
235] 
236[docs: network-and-reliance-topology.svg: nicer server icons, mv out of the "specifications" subdir
237zooko@zooko.com**20090526165842
238 Ignore-this: 8f47ab3a0ab782c1f0d46e10bcaebe5b
239] 
240[accounting-overview.txt: more edits
241warner@lothar.com**20090523190359] 
242[accounting-overview.txt: small edits
243warner@lothar.com**20090523184011] 
244[_auto_deps.py: require foolscap-0.4.1, which adds an important fix for py2.4
245warner@lothar.com**20090523011103] 
246[immutable/encode.py: tolerate immediate _remove_shareholder by copying the
247warner@lothar.com**20090522184424
248 landlord list before iterating over it. This can probably only happen in unit
249 tests, but cleaning it up makes certain test failures easier to analyze.
250] 
251[switch to using RemoteException instead of 'wrapped' RemoteReferences. Should fix #653, the rref-EQ problem
252warner@lothar.com**20090522004632] 
253[switch all foolscap imports to use foolscap.api or foolscap.logging
254warner@lothar.com**20090522003823] 
255[_auto_deps.py: bump our foolscap dependency to 0.4.0, since I'm about to start using its new features
256warner@lothar.com**20090522002100] 
257[test_runner.py: fix minor typo
258warner@lothar.com**20090520033620] 
259[docs: update network-and-reliance-topology.svg
260zooko@zooko.com**20090526163105
261 Ignore-this: 2b864b4ed8743d4a15dfbb7eff3fa561
262] 
263[setup: fix bug (wrong import) in error message, as noticed by pyflakes
264zooko@zooko.com**20090519195642
265 Ignore-this: f1b9f8c00b46c1b5f2f20e5fc424f341
266] 
267[setup: fix trivial bug in recent patch to test base64.py at startup
268zooko@zooko.com**20090519195129
269 Ignore-this: f6be038f74b53ca69e7109fe34adfbc
270] 
271[setup: make Tahoe exit at startup with a useful error message if the base64.py module is buggy (fixes part of #710)
272zooko@zooko.com**20090519194555
273 Ignore-this: aa4d398235ddca8d417d61c9688e154
274] 
275[test_introducer.py: add a test for the python2.4.0/2.4.1 bug in base64.b32decode
276warner@lothar.com**20090519034101] 
277[immutable WriteBucketProxy: use pipeline to speed up uploads by overlapping roundtrips, for #392
278warner@lothar.com**20090518234422] 
279[util/pipeline.py: new utility class to manage size-limited work pipelines, for #392
280warner@lothar.com**20090518234326] 
281[docs: add a diagram that I'm about to show to the Boulder Linux Users Group: network-and-reliance-topology.svg
282zooko@zooko.com**20090514232059
283 Ignore-this: 2420c0a7c254c9f0f2349d9130490d33
284] 
285[tests: mark test_runner as coded in utf-8 instead of ascii
286zooko@zooko.com**20090507223151
287 Ignore-this: ccf1ba9e5a9b53602701a36f9fdb545e
288] 
289[tests: raise timeout on test_runner.RunNode.test_introducer from 120s to 240s, since it hit the 120s time-out on François Lenny-armv5tel
290zooko@zooko.com**20090507215012
291 Ignore-this: ba18fe6832ba255d4971e8f623ed7da5
292] 
293[setup: fix comment in setup.py
294zooko@zooko.com**20090507215003
295 Ignore-this: c46ef664630d52733138ef7fbc551c1c
296] 
297[docs: how_to_make_a_tahoe_release.txt: a couple of small edits
298zooko@zooko.com**20090507214932
299 Ignore-this: ae92aa835ad369f4b9e6e49d681957a3
300] 
301[.darcs-boringfile: also ignore .gitignore
302warner@allmydata.com**20090415210550
303 Ignore-this: d29db314a1e506f6240859559436b4c3
304] 
305[.darcs-boringfile: ignore .git, I'm starting to play around with it
306warner@allmydata.com**20090415205929
307 Ignore-this: 89234453516483c9586cd6e1351e88b5
308] 
309[fix quicktest: stop using setuptools, add misc/run-with-pythonpath.py, to make it run faster
310warner@lothar.com**20090414201400] 
311[TAG allmydata-tahoe-1.4.1
312zooko@zooko.com**20090414025636
313 Ignore-this: de78fc32364c83e9f4e26b5abcfdea4a
314] 
315Patch bundle hash:
3165acda0412538b93e07b4e36e1378b0e8a03b015f