[KSS-checkins] r43353 - kukit/kss.pylons/trunk/kss/pylons
jvloothuis at codespeak.net
jvloothuis at codespeak.net
Mon May 14 11:19:05 CEST 2007
Author: jvloothuis
Date: Mon May 14 11:19:05 2007
New Revision: 43353
Modified:
kukit/kss.pylons/trunk/kss/pylons/helpers.py
Log:
Added base tag generater, this makes sure that we always have a proper base tag
so that KSS will now where to go.
Modified: kukit/kss.pylons/trunk/kss/pylons/helpers.py
==============================================================================
--- kukit/kss.pylons/trunk/kss/pylons/helpers.py (original)
+++ kukit/kss.pylons/trunk/kss/pylons/helpers.py Mon May 14 11:19:05 2007
@@ -1,12 +1,14 @@
import os
+from urllib import quote
+from routes import request_config
javascript_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'kukit')
java_scripts = [
- '3rd_party/sarissa.js',
'3rd_party/base2-dom-fp.js',
'3rd_party/cssQuery.js',
+ '3rd_party/sarissa.js',
'kukit/utils.js',
'kukit/kukit.js',
'kukit/actionreg.js',
@@ -30,3 +32,25 @@
def kss_javascripts():
tag = '<script type="text/javascript" src="/kukit/%s"></script>'
return ''.join([tag % script for script in java_scripts])
+
+def kss_base_tag():
+ config = request_config()
+ environ = config.environ
+
+ url = environ['wsgi.url_scheme']+'://'
+
+ if environ.get('HTTP_HOST'):
+ url += environ['HTTP_HOST']
+ else:
+ url += environ['SERVER_NAME']
+
+ if environ['wsgi.url_scheme'] == 'https':
+ if environ['SERVER_PORT'] != '443':
+ url += ':' + environ['SERVER_PORT']
+ else:
+ if environ['SERVER_PORT'] != '80':
+ url += ':' + environ['SERVER_PORT']
+
+ url += quote(environ.get('SCRIPT_NAME',''))
+
+ return '<base href="%s"/>' % url
More information about the Kukit-checkins
mailing list