- def document(self, docid, user=None):
- return self.document_for_rev(self.fulldocid(docid, user))
+ def document(self, docid, user=None, rev=u'latest'):
+ rev = self._sanitize_string(rev)
+
+ if rev != u'latest':
+ doc = self.document_for_rev(rev)
+
+ if doc.id != docid or (doc.owner != user):
+ raise wlrepo.RevisionMismatch(self.fulldocid(docid, user)+u'@'+unicode(rev))
+
+ return doc
+ else:
+ return self.document_for_rev(self.fulldocid(docid, user))