Skip to content

Commit

Permalink
CTK.Proxy triggers two new events in order to report how the content
Browse files Browse the repository at this point in the history
load went.

git-svn-id: svn://cherokee-project.com/CTK/trunk@5599 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Oct 18, 2010
1 parent 02fefe2 commit 9ba0a23
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions CTK/Proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@
url: "%(proxy_url)s",
type: "GET",
async: %(async_bool)s,
success: function(msg){
$('#%(id_widget)s').html(msg);
success: function (msg){
var me = $('#%(id_widget)s');
me.html (msg);
me.trigger ({type: 'load_ok', url: url});
},
error: function (xhr, ajaxOptions, thrownError) {
var me = $('#%(id_widget)s');
me.trigger({type: 'load_fail', url: url, status: xhr.status});
}
});
"""
Expand All @@ -58,7 +64,7 @@ def __init__ (self, host, req, props=None):

if host == None:
scgi = get_scgi()
host =scgi.env['HTTP_HOST']
host = scgi.env['HTTP_HOST']

self._async = self.props.pop('async', True)
self.id = 'proxy%d'%(self.uniq_id)
Expand All @@ -75,3 +81,10 @@ def Render (self):

render.js += JAVASCRIPT %(props)
return render

def JS_to_reload (self):
props = {'id_widget': self.id,
'proxy_url': self._url_local,
'async_bool': ['false','true'][self._async]}

return JAVASCRIPT %(props)

0 comments on commit 9ba0a23

Please sign in to comment.