Add a function to get raw base64 content on Base64Fields.
Review Request #6209 — Created Aug. 7, 2014 and submitted
Information | |
---|---|
chipx86 | |
Djblets | |
release-0.8.x | |
6208 | |
0710dc3... | |
Reviewers | |
djblets | |
Base64Field now provides a
get_<fieldname>_base64()
function that will
return the actual Base64 content, rather than the decoded content.
Made use of this in another change. Verified that I got the proper content.
Description | From | Last Updated |
---|---|---|
Can you reorder these a bit? super(Base64field, self).contribute_to_class(cls, name) setattr(cls, self.name, Base64FieldCreator(self)) def get_base64(model_instance): return self.value_to_string(model_instance) setattr(cls, 'get_%s_base64' % self.name, … |
|
-
-
djblets/db/fields.py (Diff revision 1) Can you reorder these a bit?
super(Base64field, self).contribute_to_class(cls, name) setattr(cls, self.name, Base64FieldCreator(self)) def get_base64(model_instance): return self.value_to_string(model_instance) setattr(cls, 'get_%s_base64' % self.name, get_base64)
Change Summary:
- The
get_*_base64
now just returns the encoded data stored as part of the model instance, instead of re-encoding. - Simplified the code by removing the function and using a lambda.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+3) |