Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Issue 11414143: Change models.py to use typed class members instead of a list of strings. (Closed)

Created:
8 years, 1 month ago by M-A Ruel
Modified:
8 years, 1 month ago
Reviewers:
Peter Mayo, csharp
CC:
chromium-reviews, Nicolas Sylvain, Peter Mayo (wrong one), cmp+cc_chromium.org, Isaac (away)
Visibility:
Public.

Description

Change models.py to use typed class members instead of a list of strings. This strongly reduces the mismatch when deserializing and surprises that ensue when a new member is added and is improperly initialized to None without warning. This basically reproduces the same overall idea that protobuf/django/appengine implements for serializable data but in a *much* lighter weight implementation. R=csharp@chromium.org BUG= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=169359

Patch Set 1 #

Patch Set 2 : More doc, minor fixes #

Total comments: 12

Patch Set 3 : Address review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+540 lines, -315 lines) Patch
M model.py View 1 2 3 chunks +193 lines, -55 lines 0 comments Download
M pending_manager.py View 1 2 chunks +21 lines, -33 lines 0 comments Download
M tests/model_test.py View 2 chunks +261 lines, -107 lines 0 comments Download
M tests/pending_manager_test.py View 1 chunk +0 lines, -1 line 0 comments Download
M tests/try_job_on_rietveld_test.py View 3 chunks +0 lines, -3 lines 0 comments Download
M verification/base.py View 3 chunks +5 lines, -20 lines 0 comments Download
M verification/tree_status.py View 1 chunk +1 line, -7 lines 0 comments Download
M verification/try_job_on_rietveld.py View 1 4 chunks +41 lines, -61 lines 0 comments Download
M verification/try_server.py View 1 2 chunks +18 lines, -28 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
M-A Ruel
I also think that having the datastructure members be strongly typed makes it easier to ...
8 years, 1 month ago (2012-11-23 17:04:19 UTC) #1
csharp
https://codereview.chromium.org/11414143/diff/2001/model.py File model.py (right): https://codereview.chromium.org/11414143/diff/2001/model.py#newcode80 model.py:80: if issubclass(member_type, PersistentMixIn): Link all these high level "if ...
8 years, 1 month ago (2012-11-23 18:31:57 UTC) #2
Peter Mayo
https://codereview.chromium.org/11414143/diff/2001/model.py File model.py (right): https://codereview.chromium.org/11414143/diff/2001/model.py#newcode6 model.py:6: to dict for serialization. "to and from" is usual ...
8 years, 1 month ago (2012-11-23 18:33:39 UTC) #3
M-A Ruel
thanks, uploaded. https://codereview.chromium.org/11414143/diff/2001/model.py File model.py (right): https://codereview.chromium.org/11414143/diff/2001/model.py#newcode6 model.py:6: to dict for serialization. On 2012/11/23 18:33:39, ...
8 years, 1 month ago (2012-11-23 18:44:06 UTC) #4
csharp
lgtm
8 years, 1 month ago (2012-11-23 18:51:24 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/maruel@chromium.org/11414143/2002
8 years, 1 month ago (2012-11-23 18:53:16 UTC) #6
commit-bot: I haz the power
8 years, 1 month ago (2012-11-23 18:53:38 UTC) #7
Message was sent while issue was closed.
Change committed as 169359

Powered by Google App Engine
This is Rietveld 408576698