Add lazy-lookup for static files and help for static packaging failures.

Review Request #8418 — Created Sept. 19, 2016 and submitted

Information

Djblets
release-0.10.x
93626fd...

Reviewers

We had a regression when packaging Review Board extensions that was
traced to the use of static() in a class definition. This ended up
initializing some static media support before the extension packaging
code could set some state.

There's now some helpful output for this type of failure that gives the
caller some info on what may have gone wrong and how to remedy it. It
includes a reference to a new method, static_lazy().

static_lazy() works like static(), but lazily evaluates when needed,
instead of immediately. This is safe to use in class definitions, global
variables, etc., and helps prevent the kind of regression we hit.

Tested the failure case and saw the more useful error output.

Switched code to use static_lazy(), and the problem went away.

Description From Last Updated

Oops, too quick. I think this should be six.text_type instead of unicode.

daviddavid
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/extensions/staticfiles.py
        djblets/urls/staticfiles.py
    
    Ignored Files:
        docs/djblets/coderef/index.rst
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/extensions/staticfiles.py
        djblets/urls/staticfiles.py
    
    Ignored Files:
        docs/djblets/coderef/index.rst
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
david
  1. 
      
  2. djblets/urls/staticfiles.py (Diff revision 2)
     
     
    Show all issues

    Oops, too quick. I think this should be six.text_type instead of unicode.

  3. 
      
chipx86
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        djblets/extensions/staticfiles.py
        djblets/urls/staticfiles.py
    
    Ignored Files:
        docs/djblets/coderef/index.rst
    
    
    
    Tool: Pyflakes
    Processed Files:
        djblets/extensions/staticfiles.py
        djblets/urls/staticfiles.py
    
    Ignored Files:
        docs/djblets/coderef/index.rst
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.9.x (465b7ad)
Loading...