Method
by_id
(cls, document_id, collection=None)
Source from the content-addressed store, hash-verified
| 156 | |
| 157 | @classmethod |
| 158 | def by_id(cls, document_id, collection=None): |
| 159 | try: |
| 160 | document_id = int(Namespace.strip(document_id)) |
| 161 | except Exception: |
| 162 | return |
| 163 | q = cls.all() |
| 164 | q = q.filter(cls.id == document_id) |
| 165 | if collection is not None: |
| 166 | q = q.filter(cls.collection_id == collection.id) |
| 167 | return q.first() |
| 168 | |
| 169 | @classmethod |
| 170 | def by_content_hash(cls, content_hash): |
Tested by
no test coverage detected