Skip to content

Commit

Permalink
Replaces a global variable by a class static property. Thanks to
Browse files Browse the repository at this point in the history
Esteban Feldman and Jedrzej Nowak for the original patch.

git-svn-id: svn://cherokee-project.com/CTK/trunk@5593 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Oct 16, 2010
1 parent 23a7ef6 commit e37306d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions CTK/Widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
from util import json_dump
from PageCleaner import Postprocess

widget_uniq_id = 1;

SYNC_JS_LOAD_JS = """
if (typeof (__loaded_%(name)s) == 'undefined') {
$.ajax ({url: '%(url)s', type:'get', dataType:'script', async:false, global:false, cache:true, ifModified:true});
Expand Down Expand Up @@ -102,12 +100,13 @@ def toJSON (self):


class Widget:
def __init__ (self):
global widget_uniq_id;
# Class prop
widget_uniq_id = 1

widget_uniq_id += 1;
self.uniq_id = widget_uniq_id;
self.id = "widget_%d" %(widget_uniq_id)
def __init__ (self):
Widget.widget_uniq_id += 1;
self.uniq_id = Widget.widget_uniq_id;
self.id = "widget_%d" %(Widget.widget_uniq_id)
self.binds = []

def Render (self):
Expand Down

0 comments on commit e37306d

Please sign in to comment.