summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ee99985)
raw | patch | inline | side by side (parent: ee99985)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 5 Apr 2004 00:51:45 +0000 (00:51 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 5 Apr 2004 00:51:45 +0000 (00:51 +0000) |
- 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
- 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 fa03c4bd379a13ff62495ef4521e36293fecae6e..b8bfc51707a77a4b5d0b4797ce7b54d549117ab6 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
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)
- 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 eccccf6dfbf1ffe7f955261988b03f1880c560fb..243eb0335ffdabce601a7231826244bd6a96df2f 100644 (file)
--- a/doc/customizing.txt
+++ b/doc/customizing.txt
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
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<id>/<name>)
=============== ========================================================
Note that if you have a property of the same name as one of the above
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
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
index cf48e3ce96bc65007f6dcfaa815a4b1958c469de..0d5956a0b669231873f0959c53d58e654fbf136e 100644 (file)
Binary files a/doc/roundup-favicon.ico and b/doc/roundup-favicon.ico differ
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 499618a9acb21da56249e42c80090e170656b43a..72e1d9d1123c6fc1984bd0c347dc64df209dcad6 100644 (file)
--- a/doc/whatsnew-0.7.txt
+++ b/doc/whatsnew-0.7.txt
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:
+
+ <tr tal:repeat="file context/files">
+ <td>
+ <a tal:attributes="href file/download_url"
+ tal:content="file/name">dld link</a>
+ </td>
+ ...
+
+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
===============
index 50f612a0e6c3e0162136c5f541943f92b91c710c..324e75f47ac5114833fbdeeb51b05fb6139f2706 100644 (file)
"""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
# 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):
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?
'''
'''
return str(value) in self._value
+ def isset(self):
+ '''Is my _value []?'''
+ return self._value == []
+
def reverse(self):
''' return the list in reverse order
'''
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)
+
index 67be0d619635d764280e95d3413bc427264fba50..2b20fd7b7d2d24a12c75ba416c7d099cb7935070 100644 (file)
"""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'
import roundup.instance
from roundup.i18n import _
+try:
+ import signal
+except:
+ signal = None
+
#
## Configuration
#
import zlib, base64
favico = zlib.decompress(base64.decodestring('''
-eJztkTlM2lEcgD9aoEqL0FqFIhahKFIsPbWtLcUeWuxBCxZb6kLi0oE4GDcHj0Tj6mDiYDQmJg4m
-6uDGxCYhgsFIjFFjdNLBI94Rsf96dXNp0snv5R3f7/fe7yXvgUhoSiXCmMIvCWQC+UIXQuRwHD+P
-oaEhBgYG6O/vp7e3l56eHjo6Omhvb6elpYWmpiYaGhqor6+nuroar9eLx+PB5XKRTCZJJBLs7u6y
-vb3N5uY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rLXJ88eppvxwEfV3f
+NY3Y6exofVdsV3+2wnPFDdPjB83n7xuVpcFvygPbGwxF31LZIKrQDfR2Xvh7lmrX654L/7bvlnng
+bn3Zuj8M9Hepux6VfZtW1yA6K7cfGqVu8TL325u+fHTb71QKbk+7TZQ+lTc6RcnpqW8qmVQBoj/g
+23eo0sr/NIGvB37K+lOWXMvJ+uWFeKGU/03Cb7n3D4M3wxI=
'''.strip()))
class RoundupRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
index cc83601075ceb9393f874d326de244bee2877dfb..bb814300907cad544a4ee218c5fd73965ae223ce 100644 (file)
@@ -103,7 +103,7 @@ python:db.user.classhelp('username,realname,address', property='nosy', width='60
<tr><th>File name</th><th>Uploaded</th><th>Type</th><th>Edit</th></tr>
<tr tal:repeat="file context/files">
<td>
- <a tal:attributes="href string:file${file/id}/${file/name}"
+ <a tal:attributes="href file/download_url"
tal:content="file/name">dld link</a>
</td>
<td>