From: richard Date: Mon, 5 Apr 2004 00:51:45 +0000 (+0000) Subject: - added a favicon X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=279d687a1b55fb3aff972a38a087ab66ed5fdd72;p=roundup.git - added a favicon - added url_quote and html_quote methods to the utils object - added isset method to HTMLProperty - added "download_url" method to generate a correctly quoted URL for file download links (sf bug 927745) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2251 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index fa03c4b..b8bfc51 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -3,7 +3,9 @@ are given with the most recent entry first. 2004-??-?? 0.7.0 Feature: -- added a favicon (with crappy white background) +- added a favicon +- added url_quote and html_quote methods to the utils object +- added isset method to HTMLProperty Fixed: - CSV export was busted (as was any action returning a result) @@ -12,6 +14,8 @@ Fixed: - MySQL and Postgresql use BOOL/BOOLEAN for Boolean types - OTK generation was busted (thanks Stuart D. Gathman) - export and import now include journals (incompatible with export < 0.7) +- added "download_url" method to generate a correctly quoted URL for file + download links (sf bug 927745) 2004-03-27 0.7.0b2 diff --git a/doc/customizing.txt b/doc/customizing.txt index eccccf6..243eb03 100644 --- a/doc/customizing.txt +++ b/doc/customizing.txt @@ -2,7 +2,7 @@ Customising Roundup =================== -:Version: $Revision: 1.131 $ +:Version: $Revision: 1.132 $ .. This document borrows from the ZopeBook section on ZPT. The original is at: http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx @@ -1602,6 +1602,8 @@ hasPermission specific to the "user" class - determine whether the is_edit_ok is the user allowed to Edit the current item? is_view_ok is the user allowed to View the current item? is_retired is the item retired? +download_url generates a url-quoted link for download of FileClass + item contents (ie. file/) =============== ======================================================== Note that if you have a property of the same name as one of the above @@ -1713,6 +1715,7 @@ menu only on Link and Multilink properties - render a form select list for this property reverse only on Multilink properties - produce a list of the linked items in reverse order +isset returns True if the property has been set to a value =========== ================================================================ All of the above functions perform checks for permissions required to @@ -1862,6 +1865,8 @@ as described below. Method Description =============== ======================================================== Batch return a batch object using the supplied list +url_quote quote some text as safe for a URL (ie. space, %, ...) +html_quote quote some text as safe in HTML (ie. <, >, ...) =============== ======================================================== You may add additional utility methods by writing them in your tracker diff --git a/doc/roundup-favicon.ico b/doc/roundup-favicon.ico index cf48e3c..0d5956a 100644 Binary files a/doc/roundup-favicon.ico and b/doc/roundup-favicon.ico differ diff --git a/doc/whatsnew-0.7.txt b/doc/whatsnew-0.7.txt index 499618a..72e1d9d 100644 --- a/doc/whatsnew-0.7.txt +++ b/doc/whatsnew-0.7.txt @@ -217,6 +217,27 @@ The stylesheet includes printer settings now too, so printed pages don't include the sidebar. +Quoting of URLs and HTML +------------------------ + +Templates that wish to offer file downloads may now use a new +``download_url`` method: + + + + dld link + + ... + +The ``download_url`` method looks up the file's "id" and "name" and +generates a correctly-quoted URL. + +Additionally, users wishing to URL- or HTML- quote text in their templates +may use the new ``utils.url_quote(url)`` and ``utils.html_quote(html)`` +methods. + + Email Interface =============== diff --git a/roundup/cgi/templating.py b/roundup/cgi/templating.py index 50f612a..324e75f 100644 --- a/roundup/cgi/templating.py +++ b/roundup/cgi/templating.py @@ -1,5 +1,15 @@ """Implements the API used in the HTML templating for the web interface. """ + +todo = ''' +- Most methods should have a "default" arg to supply a value + when none appears in the hyperdb or request. +- Multilink property additions: change_note and new_upload +- Add class.find() too +- NumberHTMLProperty should support numeric operations +- HTMLProperty should have an isset() method +''' + __docformat__ = 'restructuredtext' from __future__ import nested_scopes @@ -900,6 +910,15 @@ class HTMLItem(HTMLInputMixin, HTMLPermissions): # use our fabricated request return pt.render(self._client, req.classname, req) + def download_url(self): + ''' Assume that this item is a FileClass and that it has a name + and content. Construct a URL for the download of the content. + ''' + name = self._klass.get(self._nodeid, 'name') + url = '%s%s/%s'%(self._classname, self._nodeid, name) + return urllib.quote(url) + + class HTMLUserPermission: def is_edit_ok(self): @@ -995,6 +1014,10 @@ class HTMLProperty(HTMLInputMixin, HTMLPermissions): return cmp(self._value, other._value) return cmp(self._value, other) + def isset(self): + '''Is my _value None?''' + return self._value is None + def is_edit_ok(self): ''' Is the user allowed to Edit the current class? ''' @@ -1527,6 +1550,10 @@ class MultilinkHTMLProperty(HTMLProperty): ''' return str(value) in self._value + def isset(self): + '''Is my _value []?''' + return self._value == [] + def reverse(self): ''' return the list in reverse order ''' @@ -2084,3 +2111,11 @@ class TemplatingUtils: return Batch(self.client, sequence, size, start, end, orphan, overlap) + def url_quote(self, url): + '''URL-quote the supplied text.''' + return urllib.quote(url) + + def html_quote(self, html): + '''HTML-quote the supplied text.''' + return cgi.escape(url) + diff --git a/roundup/scripts/roundup_server.py b/roundup/scripts/roundup_server.py index 67be0d6..2b20fd7 100644 --- a/roundup/scripts/roundup_server.py +++ b/roundup/scripts/roundup_server.py @@ -17,7 +17,7 @@ """Command-line script that runs a server over roundup.cgi.client. -$Id: roundup_server.py,v 1.40 2004-04-02 06:38:42 richard Exp $ +$Id: roundup_server.py,v 1.41 2004-04-05 00:51:45 richard Exp $ """ __docformat__ = 'restructuredtext' @@ -32,6 +32,11 @@ from roundup.cgi import cgitb, client import roundup.instance from roundup.i18n import _ +try: + import signal +except: + signal = None + # ## Configuration # @@ -60,17 +65,16 @@ LOGFILE = None import zlib, base64 favico = zlib.decompress(base64.decodestring(''' -eJztkTlM2lEcgD9aoEqL0FqFIhahKFIsPbWtLcUeWuxBCxZb6kLi0oE4GDcHj0Tj6mDiYDQmJg4m -6uDGxCYhgsFIjFFjdNLBI94Rsf96dXNp0snv5R3f7/fe7yXvgUhoSiXCmMIvCWQC+UIXQuRwHD+P -oaEhBgYG6O/vp7e3l56eHjo6Omhvb6elpYWmpiYaGhqor6+nuroar9eLx+PB5XKRTCZJJBLs7u6y -vb3N5uYma2tr2Gw2VlZWWF5eZmFhgfn5eebm5rBYLMzMzGA2m5mensZkMjE1NUU8HicWi6HT6Rgf -HycSiaBSqRgdHUWhUCCXy5FIJIyMjCASiRgeHmZwcJC+vj66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u+fHTb71QKbk+7TZQ+lTc6RcnpqW8qmVQBoj/g +23eo0sr/NIGvB37K+lOWXMvJ+uWFeKGU/03Cb7n3D4M3wxI= '''.strip())) class RoundupRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): diff --git a/templates/classic/html/issue.item.html b/templates/classic/html/issue.item.html index cc83601..bb81430 100644 --- a/templates/classic/html/issue.item.html +++ b/templates/classic/html/issue.item.html @@ -103,7 +103,7 @@ python:db.user.classhelp('username,realname,address', property='nosy', width='60 File nameUploadedTypeEdit - dld link