-
-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added a synchronous cluster simulation * added a test for the sync function * moved signing into its own module * refactored imports to solve circular import problems stemming from the task module pretending to be a cluster * added documentation for the new sync option
- Loading branch information
Showing
7 changed files
with
123 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
try: | ||
import cPickle as pickle | ||
except ImportError: | ||
import pickle | ||
|
||
from django.core import signing | ||
from django_q.conf import Conf | ||
|
||
BadSignature = signing.BadSignature | ||
|
||
class SignedPackage(object): | ||
""" | ||
Wraps Django's signing module with custom Pickle serializer | ||
""" | ||
|
||
@staticmethod | ||
def dumps(obj, compressed=Conf.COMPRESSED): | ||
return signing.dumps(obj, | ||
key=Conf.SECRET_KEY, | ||
salt='django_q.q', | ||
compress=compressed, | ||
serializer=PickleSerializer) | ||
|
||
@staticmethod | ||
def loads(obj): | ||
return signing.loads(obj, | ||
key=Conf.SECRET_KEY, | ||
salt='django_q.q', | ||
serializer=PickleSerializer) | ||
|
||
|
||
class PickleSerializer(object): | ||
""" | ||
Simple wrapper around Pickle for signing.dumps and | ||
signing.loads. | ||
""" | ||
|
||
@staticmethod | ||
def dumps(obj): | ||
return pickle.dumps(obj) | ||
|
||
@staticmethod | ||
def loads(data): | ||
return pickle.loads(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters