forked from buildbot/buildbot
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add asDict() member function to many status classes
This is to ease json output generation. Conflicts: buildbot/sourcestamp.py
- Loading branch information
Showing
3 changed files
with
138 additions
and
2 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
4c019d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The htmlDict() function that many of these has wasn't good enough? It feels a bit silly to have two return-as-dict functions in change and sourcestamp.
Maybe the jinja-templates need some modification to suit the json-stuff, but surely we could re-use more code here, no?
Most WebStatus pages build plain dicts, and I had planned to implement some logic to optionally return a json string based on that.
4c019d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
html_dict() wasn't on 0.7.12 and I wrote it on top of that release since we're already using it.
I had standardized asDict() accross all the *Status objects. I don't mind either way. The json status is already written btw.
4c019d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marcus - you're right. Let's make this a task to take care of once everyone is on the Jinja bandwagon, as long as we can keep the json output essentially unchanged. I really like the built-in help for the JSON status!
4c019d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maruel: right. But the json wasn't merged when I wrote the jinja-port ;)
Anyway, yeah, we should do what we can to keep it similar. I think it should be possible to have it rather similar anyway, as the data ought not to differ too much. Most of the filtering/escaping is done in the template at the moment, which is quite nice w.r.t. cooperation with the json-view.
4c019d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to follow up, I've removed my htmldict()'s and used the asDict where appropriate, as listed on http://buildbot.net/trac/ticket/704