• 
      

    Changed JS extension support to be more flexible.

    Review Request #5375 — Created Feb. 1, 2014 and submitted

    Information

    Djblets
    master

    Reviewers

    This replaces the old Extension.js_model_class attribute with a list
    of JSExtension subclasses stored in Extension.js_extensions.

    Each JSExtension subclass lists a JS model class. It also has an
    apply_to field that works like those in bundles and TemplateHook. If not
    provided, the extension will be initialized on all pages.

    get_js_model_data has also moved to JSExtension, renamed to
    get_model_data.

    Extensions taking advantage of js_model_class in the Djblets 0.8 alphas
    will need to be updated for this change.

    Updated the rbseverity extension for this change, taking advantage of
    apply_to, and saw the extension's initialization appear only on the
    pages listed.

    Description From Last Updated

    This might be more readable as: return url_name in (self.apply_to or [])

    daviddavid
    david
    1. 
        
    2. djblets/extensions/extension.py (Diff revision 1)
       
       
      Show all issues

      This might be more readable as:

      return url_name in (self.apply_to or [])
      
      1. I assume you mean:

        return url_name in (self.apply_to or [url_name])
        

        I could do that. I was intending to have the default of None mean all, and anything custom-set by the user (including an empty list) being an override of that default. Either way, though, it's weird for someone to set [], since it just won't load.

      2. I misread the logic here. What you have is good. Ship it.

    3. 
        
    david
    1. Ship It!

    2. 
        
    chipx86
    Review request changed
    Status:
    Completed