Added error handling on template import. Disabled templates menu when there is no website. There is no graceful error handling for website and theme export (raise is called)  and even if there were it would show in a new window, as those export methods (websitexyz.export, themexyz.export) are called from a js window.open with src equal to the respective export method. So, I used a hidden iframe to hide that from the user for my templatexyz.export method. To avoid an error altogether, I had to disable the ‘export current website and active theme as site template' menu item when there is no active theme. The problem with that, though, is that the Ext js responsible for the main menu doesn't know whether the current website has an active theme or not, and neither does the dom (which is why, I assume, the 'themes' menu in the main menu has no export option). So, I made a website_controller method has_active_theme and a matching ajax call to decode the response (‘true’ or ‘false’) and enable it accordingly.