Change Summary:
Found a spot in djblets/webapi/resources.py where I'd gone back to 2 spaces. Fixed.
Review Request #1618 — Created May 28, 2010 and submitted
Information | |
---|---|
mike_conley | |
Djblets | |
extensions | |
Reviewers | |
djblets, reviewboard | |
This review request combines and modifies both http://reviews.reviewboard.org/r/1594 and http://reviews.reviewboard.org/r/1590/ . These requests have since been discarded. I've created an Extensions resource for the Djblets API. Authorized users can get the entire list of extensions from a GET on /api/extensions/, or info on a particular extension through a GET on /api/extensions/[extension id]/. Enabling and disabling extensions is accomplished through a PUT on /api/extensions/[extension id]/ with an "enabled" boolean parameter. The UI has been updated to use this API through AJAX queries. Errors during enabling/disabling should be displayed in a modal dialog box (see screenshot). Some of the CSS, and a few of the images have been copied from the RB project. Not sure if we want that duplication. Just a heads up. Another note - I've added a new field to the RegisteredExtensions table. This means, if you're following along with me, you'll need to perform an evolve on your DB. All feedback welcome.
All manual at this point. Which is unfortunate. :(
Found a spot in djblets/webapi/resources.py where I'd gone back to 2 spaces. Fixed.
I've based this diff off of the current extensions branch - should be easier to apply now.
Diff: |
Revision 3 (+347 -37)
|
---|
A return statement got cut off. Fixed.
Diff: |
Revision 4 (+348 -37)
|
---|
djblets/extensions/base.py (Diff revision 4) |
---|
Probably don't need these comments, since the exception name is self-explanatory.
djblets/extensions/base.py (Diff revision 4) |
---|
I think the original formatting is fine, as that's the standard way it's done with Django urls.py files.
djblets/extensions/errors.py (Diff revision 4) |
---|
Since we're just reusing the default constructor, these can just be: class EnablingExtensionError(Exception): pass
djblets/extensions/templates/extensions/extension_dlgs.html (Diff revision 4) |
---|
Multi-line comments should be in this form: /* * Comment line 1 * Comment line 2 */ Also, this comment will be repeated per-extension. It should be moved out before the for loop.
djblets/extensions/templates/extensions/extension_list.html (Diff revision 4) |
---|
This should use ?{{MEDIA_SERIAL}}
djblets/extensions/templates/extensions/extension_list.html (Diff revision 4) |
---|
No spaces within the {{..}}
djblets/extensions/templatetags/djblets_extensions.py (Diff revision 4) |
---|
This might be better as a filter, so we can do: {% if extension|has_disabled_requirements %}
djblets/extensions/templatetags/djblets_extensions.py (Diff revision 4) |
---|
This shouldn't say what value it returns specifically in the summary. More like: "Returns whether or not an extension has one or more disabled requirements."
djblets/webapi/errors.py (Diff revision 4) |
---|
I prefer not to have words like "can't" in a name. Maybe "ENABLE_EXTENSION_FAILED" and "DISABLE_EXTENSION_FAILED"
djblets/webapi/resources.py (Diff revision 4) |
---|
Constructor initialization should be first. Also, should user super() to initialize the parent class.
djblets/webapi/resources.py (Diff revision 4) |
---|
Try formatting it like: ext_class = self.extension_manager.get_installed_extension( registered_extension.class_name)
djblets/webapi/resources.py (Diff revision 4) |
---|
Doesn't enable_extension take care of this? If the problem is that our version is stale, then we should just re-fetch it on returning it, instead of faking the value.
Thanks for the feedback - updated.
Diff: |
Revision 5 (+327 -35)
|
---|
Gave WebAPIError a with_message method, to return a copy of itself with a contextual message to override the default. InvalidExtensionError also now reports the ID of the extension that isn't recognized. InvalidExtensionErrors are now caught and handled through the ExtensionResource.
Diff: |
Revision 6 (+407 -37) |
---|
Can you re-pull and merge your branches and update this? It seems to include bits of other changes. Otherwise, looks good to me. I'll commit it once there's an updated patch.
Alright, I think I merged up this one properly. I think. Let me know if I didn't.
Diff: |
Revision 7 (+336 -33)
|
---|
This patch is available here: http://github.com/mikeconley/djblets/commits/rr1618_extension_enabling_disabling_api
Patch updated for latest extensions branch
Diff: |
Revision 9 (+336 -34)
|
---|