NickDaly/Plinth — pull request #89 by fonfon (2014-07-16 13:08:54+00:00)
Title: Use djangos URL system; Refactored actions.py

#### Use django's URL system
Instead of hard-coding URLs, use djangos named URLs. This way URLs are defined once and referred to from everywhere else. It's easier to notice broken URLs, easier to change (a lot of) URLs and harder to break URLs. Additionally I removed 'basehref' from the codebase, and a lot of cfg.server_dir usage. This was used as a subfolder-like url prefix, and is handled by django's urlsystem instead now. And it did not work properly, some URLs were broken when using the default server_dir '/'.
#### Refactored actions.py
I refactored actions.py to use Exceptions instead of returning a (output, error) tuple. Parts were broken before, i.e. changing the hostname didn't work for me (sudo password missing), but I still got a success message.
#### Some minor improvements
* in debug mode, raise errors when initializing/loading modules instead of only logging them
* a bit more pep8
* a middleware that forwards to firstboot if it's not yet done (this will be for every request, so tell me if that's not desired behavior!)