Rev 4538: Add AbsentContentFactory.get_bytes_as() in http://bazaar.launchpad.net/~jameinel/bzr/1.18-absent-content

John Arbash Meinel john at arbash-meinel.com
Wed Jul 15 17:52:32 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/1.18-absent-content

------------------------------------------------------------
revno: 4538
revision-id: john at arbash-meinel.com-20090715165226-ot2qb72eexefm2im
parent: pqm at pqm.ubuntu.com-20090715083553-ssotnv68cr0x5yxr
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.18-absent-content
timestamp: Wed 2009-07-15 11:52:26 -0500
message:
  Add AbsentContentFactory.get_bytes_as()
  
  This at least gives us an exception that describes what key is missing,
  rather than giving us a generic 'AttributeError'.
-------------- next part --------------
=== modified file 'bzrlib/versionedfile.py'
--- a/bzrlib/versionedfile.py	2009-07-06 20:21:34 +0000
+++ b/bzrlib/versionedfile.py	2009-07-15 16:52:26 +0000
@@ -175,6 +175,12 @@
         self.key = key
         self.parents = None
 
+    def get_bytes_as(self, storage_kind):
+        raise ValueError('A request was made for key: %s, but that'
+                         ' content is not available, and the calling'
+                         ' code does not handle if it is missing.'
+                         % (self.key,))
+
 
 class AdapterFactory(ContentFactory):
     """A content factory to adapt between key prefix's."""



More information about the bazaar-commits mailing list