| 1 | Thu Jul 22 04:51:05 GMT Daylight Time 2010 david-sarah@jacaranda.org |
|---|
| 2 | * web.filenode: include the current (rather than cached) file size in the JSON metadata for a mutable file. fixes #677 |
|---|
| 3 | |
|---|
| 4 | New patches: |
|---|
| 5 | |
|---|
| 6 | [web.filenode: include the current (rather than cached) file size in the JSON metadata for a mutable file. fixes #677 |
|---|
| 7 | david-sarah@jacaranda.org**20100722035105 |
|---|
| 8 | Ignore-this: 217289ca072bbf111c5367d6e0d963a2 |
|---|
| 9 | ] hunk ./src/allmydata/web/filenode.py 471 |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | def FileJSONMetadata(ctx, filenode, edge_metadata): |
|---|
| 13 | - rw_uri = filenode.get_write_uri() |
|---|
| 14 | - ro_uri = filenode.get_readonly_uri() |
|---|
| 15 | - data = ("filenode", {}) |
|---|
| 16 | - data[1]['size'] = filenode.get_size() |
|---|
| 17 | - if ro_uri: |
|---|
| 18 | - data[1]['ro_uri'] = ro_uri |
|---|
| 19 | - if rw_uri: |
|---|
| 20 | - data[1]['rw_uri'] = rw_uri |
|---|
| 21 | - verifycap = filenode.get_verify_cap() |
|---|
| 22 | - if verifycap: |
|---|
| 23 | - data[1]['verify_uri'] = verifycap.to_string() |
|---|
| 24 | - data[1]['mutable'] = filenode.is_mutable() |
|---|
| 25 | - if edge_metadata is not None: |
|---|
| 26 | - data[1]['metadata'] = edge_metadata |
|---|
| 27 | - return text_plain(simplejson.dumps(data, indent=1) + "\n", ctx) |
|---|
| 28 | + d = filenode.get_current_size() |
|---|
| 29 | + def _got_size(size): |
|---|
| 30 | + data = ("filenode", {}) |
|---|
| 31 | + data[1]['size'] = size |
|---|
| 32 | + rw_uri = filenode.get_write_uri() |
|---|
| 33 | + ro_uri = filenode.get_readonly_uri() |
|---|
| 34 | + if ro_uri: |
|---|
| 35 | + data[1]['ro_uri'] = ro_uri |
|---|
| 36 | + if rw_uri: |
|---|
| 37 | + data[1]['rw_uri'] = rw_uri |
|---|
| 38 | + verifycap = filenode.get_verify_cap() |
|---|
| 39 | + if verifycap: |
|---|
| 40 | + data[1]['verify_uri'] = verifycap.to_string() |
|---|
| 41 | + data[1]['mutable'] = filenode.is_mutable() |
|---|
| 42 | + if edge_metadata is not None: |
|---|
| 43 | + data[1]['metadata'] = edge_metadata |
|---|
| 44 | + return text_plain(simplejson.dumps(data, indent=1) + "\n", ctx) |
|---|
| 45 | + d.addCallback(_got_size) |
|---|
| 46 | + return d |
|---|
| 47 | |
|---|
| 48 | def FileURI(ctx, filenode): |
|---|
| 49 | return text_plain(filenode.get_uri(), ctx) |
|---|
| 50 | |
|---|
| 51 | Context: |
|---|
| 52 | |
|---|
| 53 | [__init__.py: silence DeprecationWarning about BaseException.message globally. fixes #1129 |
|---|
| 54 | david-sarah@jacaranda.org**20100720011939 |
|---|
| 55 | Ignore-this: 38808986ba79cb2786b010504a22f89 |
|---|
| 56 | ] |
|---|
| 57 | [test_runner: test that 'tahoe --version' outputs no noise (e.g. DeprecationWarnings). |
|---|
| 58 | david-sarah@jacaranda.org**20100720011345 |
|---|
| 59 | Ignore-this: dd358b7b2e5d57282cbe133e8069702e |
|---|
| 60 | ] |
|---|
| 61 | [TAG allmydata-tahoe-1.7.1 |
|---|
| 62 | zooko@zooko.com**20100719131352 |
|---|
| 63 | Ignore-this: 6942056548433dc653a746703819ad8c |
|---|
| 64 | ] |
|---|
| 65 | Patch bundle hash: |
|---|
| 66 | 37435205139403a8ba71c719b335711f0dcd7244 |
|---|