Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store serializers #4677

Merged
merged 12 commits into from May 6, 2016
Merged

Store serializers #4677

merged 12 commits into from May 6, 2016

Conversation

phlax
Copy link
Member

@phlax phlax commented Apr 25, 2016

Fixes #4675

I need to add some tests and docs, and a cli command so that you can configure the de/serializers for a project.

@phlax phlax force-pushed the store_serializers branch 15 times, most recently from 5d99620 to 9cd39cb Compare April 27, 2016 05:57


class Command(PootleCommand):
help = "Update database stores from files."
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wrong - from me copying the file

@phlax phlax force-pushed the store_serializers branch 4 times, most recently from 4ad9415 to 197d30d Compare April 28, 2016 09:37
@codecov-io
Copy link

codecov-io commented Apr 28, 2016

Current coverage is 84.11%

Merging #4677 into master will increase coverage by +0.42%

@@             master      #4677   diff @@
==========================================
  Files           326        331     +5   
  Lines         17846      18248   +402   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          14935      15349   +414   
+ Misses         2911       2899    -12   
  Partials          0          0          
  1. 2 files (not in diff) in ...test_pootle/fixtures were modified. more
    • Misses -12
    • Hits +12

Powered by Codecov. Last updated by 1d89f99...896252b

@phlax phlax force-pushed the store_serializers branch 8 times, most recently from 44d5e18 to 59b3aa5 Compare April 28, 2016 11:58

def serialize(self):
cache = caches["exports"]
ret = cache.get(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "ret" mean?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retinaculum

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that this is carried over code (noticed after my first comment), but perhaps we can use a better word.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im gonna leave as is for now, im thinking this i might change this a little soon, but i would rather keep as was for now.


return ret
def serialize(self):
return StoreSerializer(self).serialize()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can be wrong but we use store.serialize() in import_export app only. So my question is: why we put StoreSerializer to pootle_store app?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because its related to Store serialization specifically, as opposed to eg Project or TP serialization etc.

atm, its only hooked up for import_export, but i was going to PR to pretty soon after to use it elsewhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also its for pootle_fs that is my ultimate use case, but i think that the ability to customize how data is de/serialized is pretty powerful throughout Pootle

for k in kwargs["value"]:
if k not in available_serializers:
return ValidationError(
"Unrecognised pootle.core.deserializers: '%s'" % k)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrecognised pootle.core.serializers

ret = str(store)
cache.set(path, ret, version=rev)
def deserialize(self, data):
self.update(StoreDeserializer(self).deserialize(data))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as we discussed we could deserialize first and then update.

@ta2-1
Copy link
Contributor

ta2-1 commented May 6, 2016

lgtm

@phlax phlax merged commit 3e3ea96 into translate:master May 6, 2016
@@ -21,6 +21,8 @@ Details of changes
- :djadmin:`refresh_scores` now recalculates user scores and accepts
multiple usernames.
- :djadmin:`contributors` has two new options
- :djadmin:`list_serializers` has been added to view serializers and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expanding in a separate section (and linking to it from here) on what serializers are, what they do and whether users need to care about them or not would be highly needed. Otherwise I feel like anyone reading the release notes or documentation will be pretty lost.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #4723.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Pootle FS
related
Development

Successfully merging this pull request may close these issues.

None yet

6 participants