add ChecksumPage mixin
This commit is contained in:
parent
237036ce3e
commit
a6a7130b31
1 changed files with 14 additions and 0 deletions
|
|
@ -570,3 +570,17 @@ class LoggedPage(object):
|
||||||
pages with a login form.
|
pages with a login form.
|
||||||
"""
|
"""
|
||||||
logged = True
|
logged = True
|
||||||
|
|
||||||
|
|
||||||
|
class ChecksumPage(object):
|
||||||
|
"""
|
||||||
|
Compute a checksum of raw content before parsing it.
|
||||||
|
"""
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
hashfunc = hashlib.md5
|
||||||
|
checksum = None
|
||||||
|
|
||||||
|
def build_doc(self, content):
|
||||||
|
self.checksum = self.hashfunc(content).hexdigest()
|
||||||
|
return super(ChecksumPage, self).build_doc(content)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue