From: david-sarah <david-sarah@jacaranda.org>
Date: Tue, 23 Aug 2011 01:27:20 +0000 (-0700)
Subject: Make the immutable/read-only constraint checking for MDMF URIs identical to that... 
X-Git-Tag: allmydata-tahoe-1.9.0a2~82
X-Git-Url: https://git.rkrishnan.org/specifications/%5B/%5D%20/-?a=commitdiff_plain;h=3c92b832f2958ba99997a7b5269b4604f7389b36;p=tahoe-lafs%2Ftahoe-lafs.git

Make the immutable/read-only constraint checking for MDMF URIs identical to that for SSK URIs. refs #393
---

diff --git a/src/allmydata/uri.py b/src/allmydata/uri.py
index 50b04ca8..5da7c0a6 100644
--- a/src/allmydata/uri.py
+++ b/src/allmydata/uri.py
@@ -913,9 +913,13 @@ def from_string(u, deep_immutable=False, name=u"<unknown name>"):
         elif s.startswith('URI:SSK-Verifier:'):
             return SSKVerifierURI.init_from_string(s)
         elif s.startswith('URI:MDMF:'):
-            return WriteableMDMFFileURI.init_from_string(s)
+            if can_be_writeable:
+                return WriteableMDMFFileURI.init_from_string(s)
+            kind = "URI:MDMF file writecap"
         elif s.startswith('URI:MDMF-RO:'):
-            return ReadonlyMDMFFileURI.init_from_string(s)
+            if can_be_mutable:
+                return ReadonlyMDMFFileURI.init_from_string(s)
+            kind = "URI:MDMF-RO readcap to a mutable file"
         elif s.startswith('URI:MDMF-Verifier:'):
             return MDMFVerifierURI.init_from_string(s)
         elif s.startswith('URI:DIR2:'):