Skip to content

Commit

Permalink
A few small fixes
Browse files Browse the repository at this point in the history
git-svn-id: svn://cherokee-project.com/CTK/trunk@4329 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Feb 25, 2010
1 parent f52f7eb commit b3c448c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions CTK/Container.py
Expand Up @@ -30,9 +30,12 @@ def __init__ (self):
def __len__ (self):
return len(self.child)

def __add__ (self, widget):
assert isinstance(widget, Widget)
def __nonzero__ (self):
"It is an obj, no matter its child."
return True

def __iadd__ (self, widget):
assert isinstance(widget, Widget)
self.child.append (widget)
return self

Expand Down
6 changes: 4 additions & 2 deletions CTK/PageCleaner.py
Expand Up @@ -43,12 +43,14 @@ def _remove_dupped_code (txt):
n1 = txt.find(PAGE_CLEAN_DUP_BEGIN)
if n1 == -1:
return txt

n2 = txt.find(PAGE_CLEAN_DUP_END)
assert n2 != -1

# Remove tags
maybe_dupped = txt[n1+len(PAGE_CLEAN_DUP_BEGIN):n2]
if maybe_dupped in dups:
txt = txt[:n1] + txt [n2+len(PAGE_CLEAN_DUP_END):]
txt = txt[:n1] + txt[n2+len(PAGE_CLEAN_DUP_END):]
else:
txt = txt[:n1] + maybe_dupped + txt [n2+len(PAGE_CLEAN_DUP_END):]
txt = txt[:n1] + maybe_dupped + txt[n2+len(PAGE_CLEAN_DUP_END):]
dups[maybe_dupped] = True
2 changes: 1 addition & 1 deletion CTK/Table.py
Expand Up @@ -31,7 +31,7 @@ def __init__ (self, widget=None):
self._tag = 'td'

if widget:
Container.__add__ (self, widget)
Container.__iadd__ (self, widget)

def Render (self):
# Build tag props
Expand Down

0 comments on commit b3c448c

Please sign in to comment.