Permalink
Browse files

making the output filename work for both the php and django versions

  • Loading branch information...
1 parent a03642b commit 23dc35a8187b944280c03e17f38d7cda2ef56182 @anutron committed Nov 8, 2009
Showing with 12 additions and 2 deletions.
  1. +1 −0 config/config_example.json
  2. +6 −0 django/mootools/depender/core.py
  3. +1 −1 django/mootools/depender/views.py
  4. +4 −1 php/depender.php
@@ -11,6 +11,7 @@
},
"compression": "none",
"available_compressions": ["yui", "jsmin"],
+ "output filename": "built.js",
"php: cache scripts.json": false
}
@@ -144,6 +144,12 @@ def get_client_js(self, scripts, url):
out += " builder: '" + url + "'\n"
out += "});"
return out;
+
+ def get_output_filename(self):
+ """
+ returns the filename for the header if download=true
+ """
+ return self.conf.get('output filename', 'built.js')
class Script(object):
def __init__(self, library, category, name, path, data, compressors, copyright, debug=False):
@@ -107,7 +107,7 @@ def get_arr(name):
response = HttpResponse(output, content_type="application/x-javascript")
if (download == "true"):
- response['Content-Disposition'] = 'attachment; filename=built.js'
+ response['Content-Disposition'] = 'attachment; filename=' + dpdr.get_output_filename()
return response
build.login_notrequired = True
View
@@ -171,8 +171,11 @@ public function compress($string, $path, $compression) {
public function header() {
header('Cache-Control: must-revalidate');
+ $filename = "built.js";
+ $conf = $this->getConfig();
+ if (isset($conf['php: output filename'])) $filename = $conf['php: output filename'];
if ($this->getVar('download')) {
- header('Content-Disposition: attachment; filename="built.js"');
+ header('Content-Disposition: attachment; filename="'.$filename.'"');
} else {
header("Content-Type: application/x-javascript");
}

0 comments on commit 23dc35a

Please sign in to comment.