Skip to content

Commit

Permalink
Stops the CTK.Uploader widget from adding duplicating code to the
Browse files Browse the repository at this point in the history
final HTML render.

git-svn-id: svn://cherokee-project.com/CTK/trunk@4164 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Jan 24, 2010
1 parent eaaf761 commit 8b49c5c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions CTK/Uploader.py
Expand Up @@ -25,13 +25,14 @@

from Server import publish, get_scgi
from Widget import Widget, RenderResponse
from HTTP import HTTP_Redir
from PageCleaner import Uniq_Block


HEADERS = [
'<script type="text/javascript" src="/static/js/jquery.uploadProgress.js"></script>'
]

HTML = """
CSS = """
<style type="text/css">
.bar {
width: 300px;
Expand All @@ -49,7 +50,9 @@
background: #333;
}
</style>
"""

HTML = """
<form id="%(id)s_form" enctype="multipart/form-data" action="%(upload_url)s" method="post">
<input name="file" type="file"/>
<input type="submit" value="Upload"/>
Expand Down Expand Up @@ -114,8 +117,11 @@ def Render (self):
props = {'id': self.id,
'upload_url': self._url_local}

html = HTML %(props)
js = JS %(props)
raw_html = Uniq_Block(CSS)
raw_html += HTML

html = raw_html %(props)
js = JS %(props)

render = RenderResponse (html, js, HEADERS)
return render

0 comments on commit 8b49c5c

Please sign in to comment.