You can subscribe to this list here.
| 2004 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(6) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
(8) |
Nov
(9) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(13) |
May
(34) |
Jun
(7) |
Jul
(6) |
Aug
(1) |
Sep
(23) |
Oct
(37) |
Nov
(41) |
Dec
(39) |
| 2006 |
Jan
(19) |
Feb
(1) |
Mar
(5) |
Apr
(9) |
May
(3) |
Jun
(8) |
Jul
(6) |
Aug
(12) |
Sep
(15) |
Oct
(26) |
Nov
(7) |
Dec
(11) |
| 2007 |
Jan
(12) |
Feb
(6) |
Mar
(13) |
Apr
(14) |
May
(12) |
Jun
(8) |
Jul
(3) |
Aug
|
Sep
(4) |
Oct
(19) |
Nov
(9) |
Dec
|
| 2008 |
Jan
(14) |
Feb
(3) |
Mar
(11) |
Apr
(6) |
May
(18) |
Jun
(15) |
Jul
(1) |
Aug
(23) |
Sep
(18) |
Oct
(39) |
Nov
(11) |
Dec
(16) |
| 2009 |
Jan
(8) |
Feb
(9) |
Mar
(33) |
Apr
(16) |
May
(5) |
Jun
(3) |
Jul
(2) |
Aug
(2) |
Sep
(1) |
Oct
(6) |
Nov
(11) |
Dec
(2) |
| 2010 |
Jan
(2) |
Feb
(4) |
Mar
|
Apr
|
May
(2) |
Jun
(3) |
Jul
(2) |
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
(1) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
(36) |
Sep
(8) |
Oct
(1) |
Nov
|
Dec
(10) |
| 2012 |
Jan
(3) |
Feb
(5) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
(15) |
Aug
|
Sep
(9) |
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(10) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
(4) |
| 2015 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
(1) |
Nov
(2) |
Dec
|
| 2018 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Bob T. <ta...@re...> - 2005-11-13 04:42:42
|
On Saturday 12 November 2005 10:40 pm, you wrote: > Oops, I knew there was someone I was forgetting... > > I checked in a fix to tests/conftest.py that should make the PYTHONPATH > setting unnecessary. Great, I'll snarf the patch and apply it to my debian package. > >> =A0DistributionNotFound: RuleDispatch > > This test requires RuleDispatch (the code itself is somewhat experimental= ): My fault for missing that. I have a debian package for this as well. Also,= =20 looks like it need sqlite. =2D-=20 Bob Tanner <ta...@re...> | Phone : (952)943-8700 http://www.real-time.com, Minnesota, Linux | Fax : (952)943-8500 Key fingerprint =3D AB15 0BDF BCDE 4369 5B42 1973 7CF1 A709 2CC1 B288 |
|
From: Ian B. <ia...@co...> - 2005-11-13 04:40:49
|
Bob Tanner wrote: > Bob Tanner wrote: > > >>% py.test tests/ >>============================= test process starts >>============================== >>testing-mode: inprocess >>executable: /usr/bin/python2.4 (2.4.2-final-0) >>using py lib: /usr/lib/python2.4/site-packages/py <rev unknown> >> >>tests/test_doctest_xml_compare.py FAILED TO LOAD MODULE >>tests/test_doctests.py FAILED TO LOAD MODULE >>tests/test_formgen.py FAILED TO LOAD MODULE >>tests/test_htmlfill.py FAILED TO LOAD MODULE >>tests/test_htmlgen.py FAILED TO LOAD MODULE >>tests/test_schema.py FAILED TO LOAD MODULE > > > Got a little further. > $ export PYTHONPATH="." > $ py.test tests/ Oops, I knew there was someone I was forgetting... I checked in a fix to tests/conftest.py that should make the PYTHONPATH setting unnecessary. > E [failure to get at sourcelines from > <TracebackEntry /home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/build/bdist.linux-i686/egg/pkg_resources.py:483>] > >> DistributionNotFound: RuleDispatch This test requires RuleDispatch (the code itself is somewhat experimental): easy_install -Zf http://peak.telecommunity.com/snapshots/ RuleDispatch The other failures might be actual errors. -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |
|
From: Bob T. <ta...@re...> - 2005-11-13 03:30:55
|
Bob Tanner wrote:
> % py.test tests/
> ============================= test process starts
> ==============================
> testing-mode: inprocess
> executable: /usr/bin/python2.4 (2.4.2-final-0)
> using py lib: /usr/lib/python2.4/site-packages/py <rev unknown>
>
> tests/test_doctest_xml_compare.py FAILED TO LOAD MODULE
> tests/test_doctests.py FAILED TO LOAD MODULE
> tests/test_formgen.py FAILED TO LOAD MODULE
> tests/test_htmlfill.py FAILED TO LOAD MODULE
> tests/test_htmlgen.py FAILED TO LOAD MODULE
> tests/test_schema.py FAILED TO LOAD MODULE
Got a little further.
$ export PYTHONPATH="."
$ py.test tests/
============================= test process starts
==============================
testing-mode: inprocess
executable: /usr/bin/python2.4 (2.4.2-final-0)
using py lib: /usr/lib/python2.4/site-packages/py <rev unknown>
tests/test_cc_validator.py[1] .
tests/test_context.py[3] ...
tests/test_doctest_xml_compare.py[1] .
tests/test_doctests.py[0]
tests/test_formgen.py FAILED TO LOAD MODULE
tests/test_htmlfill.py[5] F....
tests/test_htmlgen.py[7] .......
tests/test_makeform.py FAILED TO LOAD MODULE
tests/test_schema.py[10] ..........
________________________________________________________________________________
_________________________________ entrypoint:
_________________________________
try:
import doctest
doctest.OutputChecker
except AttributeError:
import formencode.util.doctest24 as doctest
> from formencode import formgen
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/tests/test_formgen.py:6]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
import fields
import pkg_resources
> pkg_resources.require('RuleDispatch')
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/formencode/formgen.py:5]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
> [failure to get at sourcelines from
<TracebackEntry /home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/build/bdist.linux-i686/egg/pkg_resources.py:503>]
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/build/bdist.linux-i686/egg/pkg_resources.py:503]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
E [failure to get at sourcelines from
<TracebackEntry /home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/build/bdist.linux-i686/egg/pkg_resources.py:483>]
> DistributionNotFound: RuleDispatch
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/build/bdist.linux-i686/egg/pkg_resources.py:483]
________________________________________________________________________________
_______________________ entrypoint: test_inputoutput[0]
________________________
def run_filename(filename):
f = open(filename)
content = f.read()
f.close()
parts = re.split(r'---*', content)
template = parts[0]
expected = parts[1]
if len(parts) == 3:
data_content = parts[2].strip()
elif len(parts) > 3:
print parts[3:]
assert 0, "Too many sections"
else:
data_content = ''
namespace = {}
if data_content:
exec data_content in namespace
data = namespace.copy()
data['defaults'] = data.get('defaults', {})
if data.has_key('check'):
checker = data['check']
del data['check']
else:
def checker(p, s):
pass
for name in data.keys():
if name.startswith('_') or hasattr(__builtins__, name):
del data[name]
listener = htmlfill_schemabuilder.SchemaBuilder()
p = htmlfill.FillingParser(listener=listener, **data)
> p.feed(template)
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/tests/test_htmlfill.py:54]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
def feed(self, data):
self.source = data
self.lines = data.split('\n')
self.source_pos = 1, 0
if self.listener:
self.listener.reset()
> HTMLParser.HTMLParser.feed(self, data)
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/formencode/htmlfill.py:113]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
def feed(self, data):
"""Feed data to the parser.
Call this as often as you want, with as little or as much text
as you want (may include '\n').
"""
self.rawdata = self.rawdata + data
> self.goahead(0)
[/usr/lib/python2.4/HTMLParser.py:108]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
def goahead(self, end):
rawdata = self.rawdata
i = 0
n = len(rawdata)
while i < n:
match = self.interesting.search(rawdata, i) # < or &
if match:
j = match.start()
else:
j = n
if i < j: self.handle_data(rawdata[i:j])
i = self.updatepos(i, j)
if i == n: break
startswith = rawdata.startswith
if startswith('<', i):
if starttagopen.match(rawdata, i): # < + letter
> k = self.parse_starttag(i)
[/usr/lib/python2.4/HTMLParser.py:148]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
def parse_starttag(self, i):
self.__starttag_text = None
endpos = self.check_for_whole_start_tag(i)
if endpos < 0:
return endpos
rawdata = self.rawdata
self.__starttag_text = rawdata[i:endpos]
# Now parse the data between i+1 and j into a tag and attrs
attrs = []
match = tagfind.match(rawdata, i+1)
assert match, 'unexpected call to parse_starttag()'
k = match.end()
self.lasttag = tag = rawdata[i+1:k].lower()
while k < endpos:
m = attrfind.match(rawdata, k)
if not m:
break
attrname, rest, attrvalue = m.group(1, 2, 3)
if not rest:
attrvalue = None
elif attrvalue[:1] == '\'' == attrvalue[-1:] or \
attrvalue[:1] == '"' == attrvalue[-1:]:
attrvalue = attrvalue[1:-1]
attrvalue = self.unescape(attrvalue)
attrs.append((attrname.lower(), attrvalue))
k = m.end()
end = rawdata[k:endpos].strip()
if end not in (">", "/>"):
lineno, offset = self.getpos()
if "\n" in self.__starttag_text:
lineno = lineno + self.__starttag_text.count("\n")
offset = len(self.__starttag_text) \
- self.__starttag_text.rfind("\n")
else:
offset = offset + len(self.__starttag_text)
self.error("junk characters in start tag: %r"
% (rawdata[k:endpos][:20],))
if end.endswith('/>'):
# XHTML-style empty tag: <span attr="value" />
self.handle_startendtag(tag, attrs)
else:
> self.handle_starttag(tag, attrs)
[/usr/lib/python2.4/HTMLParser.py:268]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
def handle_starttag(self, tag, attrs, startend=False):
self.write_pos()
if tag == 'input':
self.handle_input(attrs, startend)
elif tag == 'textarea':
self.handle_textarea(attrs)
elif tag == 'select':
self.handle_select(attrs)
elif tag == 'option':
self.handle_option(attrs)
return
elif tag == 'form:error':
> self.handle_error(attrs)
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/formencode/htmlfill.py:161]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
def handle_error(self, attrs):
name = self.get_attr(attrs, 'name')
formatter = self.get_attr(attrs, 'format') or 'default'
if name is None:
name = self.in_error
assert name is not None, (
"Name attribute in <form:error> required if not contained in "
"<form:iferror> (%i:%i)" % self.getpos())
error = self.errors.get(name, '')
if error:
> error = self.error_formatters[formatter](error)
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/formencode/htmlfill.py:216]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
def escape_formatter(error):
E return html_quote(error, 1)
> TypeError: html_quote() takes exactly 1 argument (2 given)
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/formencode/htmlfill.py:41]
- - - - - - - - - - - test_htmlfill.py: recorded stdout - - - - - - - - - -
- -
>>>> /home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/formencode/__init__.pyc
________________________________________________________________________________
_________________________________ entrypoint:
_________________________________
from sqlobject import *
> from formencode.formgen import makeform
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/tests/test_makeform.py:3]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
import fields
import pkg_resources
> pkg_resources.require('RuleDispatch')
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/formencode/formgen.py:5]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
> [failure to get at sourcelines from
<TracebackEntry /home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/build/bdist.linux-i686/egg/pkg_resources.py:503>]
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/build/bdist.linux-i686/egg/pkg_resources.py:503]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
E [failure to get at sourcelines from
<TracebackEntry /home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/build/bdist.linux-i686/egg/pkg_resources.py:483>]
> DistributionNotFound: RuleDispatch
[/home/tanner/projects/real-time/debian/turbogears/FormEncode/FormEncode-0.3/build/bdist.linux-i686/egg/pkg_resources.py:483]
________________________________________________________________________________
============= tests finished: 26 passed, 3 failed in 0.76 seconds
============
--
Bob Tanner <ta...@re...> | Phone : (952)943-8700
http://www.real-time.com, Minnesota, Linux | Fax : (952)943-8500
Key fingerprint = AB15 0BDF BCDE 4369 5B42 1973 7CF1 A709 2CC1 B288
|
|
From: Bob T. <ta...@re...> - 2005-11-13 02:41:33
|
Ian Bicking wrote: > Bob Tanner wrote: >> How do you run the tests in formencode-0.2.2 ? > > It uses py.test: http://codespeak.net/py/current/doc/test.html > > If you run "py.test tests/" from the root of the project, they'll all run. > Got py.test installed. Confirmed that py.test's testsuite all passes, but then I try to run the testsuite for formencode-0.2.2 I'm still having problems. The py <re unknown> seems suspicious, but I get the same message when I run py.test's testsuite too. % py.test tests/ ============================= test process starts ============================== testing-mode: inprocess executable: /usr/bin/python2.4 (2.4.2-final-0) using py lib: /usr/lib/python2.4/site-packages/py <rev unknown> tests/test_doctest_xml_compare.py FAILED TO LOAD MODULE tests/test_doctests.py FAILED TO LOAD MODULE tests/test_formgen.py FAILED TO LOAD MODULE tests/test_htmlfill.py FAILED TO LOAD MODULE tests/test_htmlgen.py FAILED TO LOAD MODULE tests/test_schema.py FAILED TO LOAD MODULE ________________________________________________________________________________ _________________________________ entrypoint: _________________________________ E import formencode.doctest_xml_compare as dxml > ImportError: No module named formencode.doctest_xml_compare [/home/tanner/projects/real-time/debian/turbogears/FormEncode/python-formencode-0.2.2/tests/test_doctest_xml_compare.py:1] ________________________________________________________________________________ _________________________________ entrypoint: _________________________________ import os, sys if __name__ == '__main__': base = os.path.dirname(os.path.dirname( os.path.dirname(os.path.abspath(__file__)))) sys.path.append(base) try: import doctest doctest.OutputChecker except AttributeError: import formencode.util.doctest24 as doctest E from formencode import doctest_xml_compare > ImportError: No module named formencode [/home/tanner/projects/real-time/debian/turbogears/FormEncode/python-formencode-0.2.2/tests/test_doctests.py:13] ________________________________________________________________________________ _________________________________ entrypoint: _________________________________ try: import doctest doctest.OutputChecker except AttributeError: import formencode.util.doctest24 as doctest E from formencode import formgen > ImportError: No module named formencode [/home/tanner/projects/real-time/debian/turbogears/FormEncode/python-formencode-0.2.2/tests/test_formgen.py:6] ________________________________________________________________________________ _________________________________ entrypoint: _________________________________ import sys import os import re base_dir = os.path.dirname(os.path.dirname(os.path.dirname( os.path.abspath(__file__)))) if base_dir not in sys.path: sys.path.insert(0, base_dir) E import formencode > ImportError: No module named formencode [/home/tanner/projects/real-time/debian/turbogears/FormEncode/python-formencode-0.2.2/tests/test_htmlfill.py:9] ________________________________________________________________________________ _________________________________ entrypoint: _________________________________ E from formencode.htmlgen import html > ImportError: No module named formencode.htmlgen [/home/tanner/projects/real-time/debian/turbogears/FormEncode/python-formencode-0.2.2/tests/test_htmlgen.py:1] ________________________________________________________________________________ _________________________________ entrypoint: _________________________________ E from formencode import validators, foreach > ImportError: No module named formencode [/home/tanner/projects/real-time/debian/turbogears/FormEncode/python-formencode-0.2.2/tests/test_schema.py:1] ________________________________________________________________________________ =================== tests finished: 6 failed in 0.14 seconds =================== -- Bob Tanner <ta...@re...> | Phone : (952)943-8700 http://www.real-time.com, Minnesota, Linux | Fax : (952)943-8500 Key fingerprint = AB15 0BDF BCDE 4369 5B42 1973 7CF1 A709 2CC1 B288 |
|
From: Ian B. <ia...@co...> - 2005-11-12 21:58:56
|
I just released 0.3. News follows: * Allow errors to be inserted automatically into a form when using ``formencode.htmlfill``, when a ``<form:error>`` tag isn't found for an error. * Added ``if_key_missing`` attribute to ``schema.Schema``, which will fill in any keys that are missing and pass them to the validator. * ``FancyValidator`` has changed, adding ``if_invalid_python`` and ``validate_python`` options (which also apply to all subclasses). Also ``if_empty`` only applies to ``to_python`` conversions. * ``FancyValidator`` now has a ``strip`` option, which if true and if input is a string, will strip whitespace from the string. * Allow chained validators to validate otherwise-invalid forms, if they define a ``validate_partial`` method. The credit card validator does this. * Handle ``FieldStorage`` input (from file uploads); added a ``formencode.fieldstorage`` module to wrap those instances in something a bit nicer. Added ``validators.FieldStorageUploadConverter`` to make this conversion. * Added ``StringBoolean`` converter, which converts strings like ``"true"`` to Python booleans. Bugfixes ~~~~~~~~ * A couple fixes to ``DateConverter``, ``FieldsMatch``, ``StringBoolean``, ``CreditCardValidator``. * Added missing ``Validator.assert_string`` method. * ``formencode.htmlfill_schemabuilder`` handles checkboxes better. * Be a little more careful about how ``Invalid`` exceptions are created (catch some errors sooner). * Improved handling of non-string input in ``htmlfill``. Experiments ~~~~~~~~~~~ * Some experimental work in ``formencode.formgen``. Experimental, I say! * Added an experimental ``formencode.context`` module for dynamically-scoped variables. |
|
From: Ian B. <ia...@co...> - 2005-11-12 21:28:38
|
Dan Jacob wrote:
> Would it be possible to have somewhere in formencode/api.py:
>
> def dummy_gettext(text):return text
>
> _ = __builtins__.get('_', dummy_gettext)
>
> Then:
>
> def message(self, msgName, state, **kw):
> try:
> return _(self._messages[msgName]) %kw
> except: #etc.
>
> That way if Python gettext or any other function aliased '_' is added to
> __builtins__ then FormEncode uses that function, otherwise our dummy gettext
> function just returns the plain text. This would allow e.g. TurboGears to
> use its own gettext custom function.
I don't know, that sounds a worrisome to me. For instance, what if
formencode.api is imported before __builtins__ is patched? And what
happens if multiple frameworks try to put in their own _'s? If this is
normal for localization, I suppose... but it seems odd to me.
It certainly would be possible to look for a _ implementation in the
state, maybe like:
def message(self, msgName, state, **kw):
msg = self._messages[msgName]
_ = getattr(state, '_', dummy_gettext)
try:
return _(msg) % kw
...
--
Ian Bicking | ia...@co... | http://blog.ianbicking.org
|
|
From: Ian B. <ia...@co...> - 2005-11-11 16:42:52
|
Dan Jacob wrote: > I was just discussing with Kevin Dangoor about the internationalizatio= n=20 > module for TurboGears I have submitted=20 > (http://www.turbogears.org/svn/turbogears/trunk/turbogears/i18n.py) and= =20 > I came up with an idea for localizing FormEncode error messages with a=20 > Localizer mixin: >=20 > from turbogears.i18n import gettext >=20 > class Localizer: >=20 > def message(self, msgName, state, **kw): >=20 > try: > locale =3D None > if state is not None:locale =3D getattr(state, "locale", No= ne) > return gettext(self._messages[msgName], locale) % kw > except KeyError: > raise KeyError( > "Key not found for %r=3D%r %% %r (from: %s)" > % (msgName, self._messages.get(msgName), kw, > ', '.join(self._messages.keys()))) >=20 > =20 >=20 > # localized validators: >=20 > =20 >=20 > class MinLength(Localizer, validators.MinLength):pass >=20 > class MaxLength(Localizer, validators.MaxLength):pass >=20 > class NotEmpty(Localizer, validators.NotEmpty):pass >=20 > =85 >=20 > =20 >=20 > This would be added to a package turbogears.i18n.validators, so if you= =20 > needed to use localized messages you would just call >=20 > from turbogears.i18n import validators >=20 > instead of >=20 > from turbogears import validators. >=20 > It would then be up to the developer to provide localized strings in=20 > gettext files as needed. >=20 > I was just wondering your thoughts on this, as I=92m not sure which=20 > discussion thread to put this in. The i18n module uses its own form of=20 > gettext to handle text strings, so this solution works nicely, but does= =20 > it conflict with any existing plans for FormEncode localization ? I there was some interest from Gregor Horvath, but I haven't seem any=20 progress on it since then. Anyway, I'd like to get something like this in FormEncode directly, and=20 your replacement for self.message seems very reasonable -- I had=20 something like that in mind when I made that method, but I've never done=20 localization in particular. We could put that directly in=20 Validators.message -- I think a mixin isn't very clean in comparison.=20 You mention a custom gettext, which I guess is the only issue. We'd=20 have to make it pluggable or something, so that other environments could=20 use the normal gettext or whatever else they might want. I also have no problem putting the _()'s around the messages currently=20 in validators.py, so that they can be extracted. --=20 Ian Bicking / ia...@co... / http://blog.ianbicking.org |
|
From: Ian B. <ia...@co...> - 2005-11-10 05:37:37
|
Kevin Dangoor wrote:
> Imagine a web request where the parameter for a date field is missing.
>
> dc = formencode.validators.DateConverter()
> dc.to_python(None)
>
> This yields this:
> /Users/tazzzzz/projects/turbogears/thirdparty/formencode/formencode/api.py
> in message(self, msgName, state, **kw)
> 125 return self._messages[msgName] % kw
> 126 except KeyError:
> --> 127 raise KeyError(
> 128 "Key not found for %r=%r %% %r (from: %s)"
> 129 % (msgName, self._messages.get(msgName), kw,
>
> KeyError: "Key not found for 'badType'='The input must be a string
> (not a %(type)s: %(value)r)' % {} (from: invalidYear, monthRange,
> invalidDay, badFormat, wrongFormat, invalidDate, unknownMonthName,
> empty, badType, fourDigitYear, noneType, dayRange)"
>
> I think this is a bug. None is certainly Invalid if you're expecting a
> reasonable date, but it shouldn't have an issue with generating the
> error message.
The issue was that assert_string wasn't giving type=type(value) when
raising the error. This should be fixed in r1236.
--
Ian Bicking | ia...@co... | http://blog.ianbicking.org
|
|
From: Kevin D. <da...@gm...> - 2005-11-10 02:29:27
|
Imagine a web request where the parameter for a date field is missing.
dc =3D formencode.validators.DateConverter()
dc.to_python(None)
This yields this:
/Users/tazzzzz/projects/turbogears/thirdparty/formencode/formencode/api.py
in message(self, msgName, state, **kw)
125 return self._messages[msgName] % kw
126 except KeyError:
--> 127 raise KeyError(
128 "Key not found for %r=3D%r %% %r (from: %s)"
129 % (msgName, self._messages.get(msgName), kw,
KeyError: "Key not found for 'badType'=3D'The input must be a string
(not a %(type)s: %(value)r)' % {} (from: invalidYear, monthRange,
invalidDay, badFormat, wrongFormat, invalidDate, unknownMonthName,
empty, badType, fourDigitYear, noneType, dayRange)"
I think this is a bug. None is certainly Invalid if you're expecting a
reasonable date, but it shouldn't have an issue with generating the
error message.
Kevin
--
Kevin Dangoor
Author of the Zesty News RSS newsreader
email: ki...@bl...
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com
|
|
From: Ian B. <ia...@co...> - 2005-11-10 00:05:52
|
Bob Tanner wrote: > On Wednesday 09 November 2005 05:56 pm, Ian Bicking wrote: > >>Bob Tanner wrote: >> >>>How do you run the tests in formencode-0.2.2 ? >> >>It uses py.test: http://codespeak.net/py/current/doc/test.html >> >>If you run "py.test tests/" from the root of the project, they'll all run. > > > Wow, great turn around time for a response. > > Did I miss this tidbit in the documentation or on the web site? I'm not sure; probably it is missing. > Also, I looked, but didn't find a debian package. Is there a debian package? > If not, is it ok to create one? I'm not sure either... I think there are rpms, and I think maybe debs for SQLObject. There's a program that might be useful for building a deb: http://easy-deb.sourceforge.net/ -- what I'd really like, but I don't think easy-deb does, it to be able to build an deb with "python setup.py bdist_deb" (like sdist, bdist_egg, etc). And rpms... anyway, if you or anyone can figure out how that works and perhaps a patch, I can start doing this as part of releases (probably uploading to the Cheese Shop). -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |
|
From: Bob T. <ta...@re...> - 2005-11-10 00:02:11
|
On Wednesday 09 November 2005 05:56 pm, Ian Bicking wrote: > Bob Tanner wrote: > > How do you run the tests in formencode-0.2.2 ? > > It uses py.test: http://codespeak.net/py/current/doc/test.html > > If you run "py.test tests/" from the root of the project, they'll all run. Wow, great turn around time for a response. Did I miss this tidbit in the documentation or on the web site? Also, I looked, but didn't find a debian package. Is there a debian package? If not, is it ok to create one? -- Bob Tanner <ta...@re...> | Phone : (952)943-8700 http://www.real-time.com, Minnesota, Linux | Fax : (952)943-8500 Key fingerprint = AB15 0BDF BCDE 4369 5B42 1973 7CF1 A709 2CC1 B288 |
|
From: Ian B. <ia...@co...> - 2005-11-09 23:57:28
|
Bob Tanner wrote: > How do you run the tests in formencode-0.2.2 ? It uses py.test: http://codespeak.net/py/current/doc/test.html If you run "py.test tests/" from the root of the project, they'll all run. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |
|
From: Bob T. <ta...@re...> - 2005-11-09 23:55:31
|
How do you run the tests in formencode-0.2.2 ? -- Bob Tanner <ta...@re...> | Phone : (952)943-8700 http://www.real-time.com, Minnesota, Linux | Fax : (952)943-8500 Key fingerprint = AB15 0BDF BCDE 4369 5B42 1973 7CF1 A709 2CC1 B288 |
|
From: Ian B. <ia...@co...> - 2005-11-09 16:20:48
|
Eric Noyau wrote: > Hi, > > I'm trying to use htmlfill to do some form filling and error display. > It works fine when I only have different forms on the page, but if I > use a repeated form it does not work that well. This is something that has occurred to me before, but I haven't had a chance to fix it. You should be able to give htmlfill a form id (matching an id attribute on the <form>), and it only will fill that form in. I don't know when I'll be able to get to this, though I don't think it should be too hard. Patches accepted, of course. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |
|
From: Eric N. <eri...@gm...> - 2005-11-09 13:49:59
|
Hi,
I'm trying to use htmlfill to do some form filling and error display.
It works fine when I only have different forms on the page, but if I
use a repeated form it does not work that well.
Contrived example: I have a list of employee in a table and each row
of the table let me edit a last name:
<tr>
<td>employee number</td>
<td>first</td>
<td>last</td>
<td>edit</td>
</tr>
<tr>
<td>34</td>
<td>joe</td>
<td>anonymous</td>
<td><form>
<input type="hidden" name="emp_id" value="34">
<input type="text" name="lastName" value="anonymous">
<form:error name="emp_id">
<form:error name="lastName">
<input type="submit" value="set_last_name">
</form></td>
</tr>
<tr>
...
</tr>
Everything works fine on the request side, I receive all my data,
parse it with a schema with the emp_id and the lastname, known which
employee to update using its id and everybody is happy. But of
course, when regenerating the page on error with htmlfill everything
goes wrong as there is more than one input field for each name and
errors all over the place.
I'm trying to setup a pattern to deal with this, involving both the
response side (where the form is generated from a template) and the
request side (where the form data is parsed and understood). I'd like
to avoid giving every single input element a different name as this
makes the form generation and interpretation harder to manage. A
solution like giving the form a name and telling htmlfill to only
muck with this part of the page would work for example.
Any ideas are welcome. How do you deal with such a page in your
applications?
Thanks,
-- Eric
|
|
From: Jason C. <ja...@me...> - 2005-11-07 23:09:50
|
The URL validator is n form encode is a little too strict, the current version follows RFC 1034 with the exception of not allowing ANY numbers in a URL url_re = re.compile(r'^(http|https)://[a-z\-\.]+\.[a-z]+(?:[0-9]+)? (?:/.*)?$', re.I) so it fails on fails on www.1800flowers.com Here is a version that is a little more lax but also "more" RFC1123 compliant url_re = re.compile(r'^(http|https)://[a-z0-9][a-z0-9\-\.]*\.[a-z]+(: [0-9]+)?([?/].*)?$', re.I) Note that the email vaildator's domain RE validator is a little also more lax since it allows a '-' or '.' to be the first character. domainRE = re.compile(r"^[a-z0-9\.\-]+\.[a-z]+$", re.I) Anyone have a better regex for HTTP URLs? http://www.faqs.org/rfcs/rfc1034.html section 3.5 The labels must follow the rules for ARPANET host names. They must start with a letter, end with a letter or digit, and have as interior characters only letters, digits, and hyphen. There are also some restrictions on the length. Labels must be 63 characters or less. But http://www.faqs.org/rfcs/rfc1123.html section 2.1 The syntax of a legal Internet host name was specified in RFC-952 [DNS:4]. One aspect of host name syntax is hereby changed: the restriction on the first character is relaxed to allow either a letter or a digit. Host software MUST support this more liberal syntax. Jason |
|
From: Ian B. <ia...@co...> - 2005-11-03 21:58:38
|
Sometime a while ago someone asked about an option to have the schema
fill in values that are missing. I can't remember who. Anyway, it took
a while, but now it's there in r1218 as an option on Schemas:
# If this is given, then any keys that aren't available but
# are expected will be replaced with this value (and then
# validated!) This does not override a present .if_missing
# attribute on validators:
if_key_missing = NoDefault
--
Ian Bicking / ia...@co... / http://blog.ianbicking.org
|
|
From: Ian B. <ia...@co...> - 2005-10-27 14:04:50
|
I rewrote most of the library for repeating form elements, since after reading WHAT-WG's Web Forms 2.0 spec it specifies the algorithms pretty closely. In the process most of the MochiKit dependency disappeared, as did any classes, as the spec basically describes an extension to the DOM. I'm a little mystified what the purpose of the move-up and move-down buttons are after reading through it (they just move blocks around, so the only way you can detect any change is to look at the order in which the fields come in on the request, which is often not kept track of well). I still have to figure out how to test this stuff. Probably not all that hard really -- just fire the events, or run the methods, and confirm the DOM was changed as it should be. -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |
|
From: Shannon -jj B. <jj...@gm...> - 2005-10-26 22:56:38
|
Can you show an example of how to output the individual widgets within, say, a complicated table layout? I think this is an important feature in a form generation toolkit. Best Regards, -jj On 10/22/05, Greg Steffensen <gre...@gm...> wrote: > I've been working on a form generation toolkit that integrates well with > FormEncode... its still under heavy development, of course, but I've seen= a > lot of discussion of this topic on various mailing lists over the past fe= w > days, and so wanted to get something out. Release early and all that. S= o > you can get it from > > https://developer.berlios.de/project/showfiles.php?group_id=3D4967 > > There's a README with a tutorial in there, which is also provided as a > friendlier README.html. It requires FormEncode (I developed with FormEnc= ode > 0.22, but I expect it will work with older versions). Current features > include default values, intelligent detection and rendering of "required" > fields, extensive facilities for customization of the output markup, etc. > Mainly, I've tried to make it easy to use. > > I'm a Cherrypy guy, and so aimed it at use with that; it should be > perfectly usable with TurboGears too (although its largely orthagonal to = the > (problematic) way that TurboGears currently encourages you to use forms). > Really, its usable with any framework that lets you access form submissio= ns > as a python dict. > > For a really quick intro, I've pasted the contents of a sample script th= at > uses formulaic below, along with the output that script would produce. T= he > html this script produces isn't very realistic, but customization of the > markup is very easy (I'd call it my top design goal). I didn't demonstra= te > it simply to keep the script short. > > Its nowhere remotely near finished, of course, but hopefully is at a a > point that it can be useful for real world work. Questions, suggestions, > etc. are extraordinarily welcome. > > Greg > > example.py > ------------- > #!/usr/bin/python > > from formencode import validators > from formencode.api import Invalid > > from formulaic import forms > from formulaic import basicwidgets as widgets > > form =3D forms.RequirementsForm() > form.attrs['id'] =3D 'myform' > > form['age'] =3D widgets.TextInput(validators.Int(), 'Age') > form['age'].attrs =3D {'size':'4', 'maxlength':'3'} > > colors =3D ['Red', 'Green', 'Blue'] > form['favcolor'] =3D widgets.Select(validators.OneOf(colors), 'Favorite > color', options=3Dcolors) > > form['pie'] =3D widgets.CheckboxInput(validators.Bool(), 'I like pie') > > inputs =3D {'age':'ten', 'favcolor':'Green', 'pie':'checked'} > > try: > data =3D form.schema.to_python(inputs) > print data > except Invalid, error: > print form.render(inputs, error.error_dict) > > ----------------- > > output: > > <form action=3D"" method=3D"POST" id=3D"myform"> > > <label class=3D"required">Age</label> > <input type=3D"text" name=3D"age" value=3D"ten"/> > <span class=3D"error">Please enter an integer value</span> > > <label class=3D"required">Favorite color</label> > <select type=3D"text" name=3D"favcolor"> > <option value=3D"Red">Red</option> > <option selected=3D"selected" value=3D"Green">Green</option> > <option value=3D"Blue">Blue</option> > </select> > > <label>I like pie</label> > <input type=3D"text" checked=3D"checked" name=3D"pie"/> > > <input type=3D"submit" value=3D"Submit"/> > > </form> -- Hacking is to climbing Mt. Everest as software engineering is to building a Denny's there. |
|
From: Ian B. <ia...@co...> - 2005-10-26 22:49:38
|
Christopher Lenz wrote: > Am 26.10.2005 um 07:32 schrieb Ian Bicking: > >> I kind of threw it out prematurely. I moved it here with an HTML >> example: >> >> http://svn.colorstudy.com/home/ianb/repeat_form/ >> >> I guess Subversion doesn't send out pages as text/html, so you can't >> view the example directly. > > > It does if you set the svn:mime-type property to "text/html". Thanks, that does indeed work. Though the code uses svn:externals to bring in MochiKit, so it still doesn't quite work :-/ I can't remember if Javascript will allow me to include MochiKit from another domain... I suppose it would. But for now I've just made a checkout for a fully working demo: http://ianbicking.org/examples/repeat_form/form.html -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |
|
From: Christopher L. <cm...@gm...> - 2005-10-26 10:37:00
|
Am 26.10.2005 um 07:32 schrieb Ian Bicking: > I kind of threw it out prematurely. I moved it here with an HTML > example: > > http://svn.colorstudy.com/home/ianb/repeat_form/ > > I guess Subversion doesn't send out pages as text/html, so you can't > view the example directly. It does if you set the svn:mime-type property to "text/html". Cheers, Chris -- Christopher Lenz cmlenz at gmx.de http://www.cmlenz.net/ |
|
From: Ian B. <ia...@co...> - 2005-10-26 05:32:45
|
Bob Ippolito wrote: >> I wanted to get this out before I go out on vacation, since I think >> it's useful in the context of some of the form discussions that have >> been going around on these lists. It's a Javascript library (using >> MochiKit) that primarily implements the repeating field model as >> defined in WHAT-WG: http://www.whatwg.org/specs/web-forms/ >> current-work/#repeatingFormControls >> >> This is just a temporary location. > > > I started taking a look at this... but do you have any HTML that > demonstrates any of this working? That'd certainly save time. I kind of threw it out prematurely. I moved it here with an HTML example: http://svn.colorstudy.com/home/ianb/repeat_form/ I guess Subversion doesn't send out pages as text/html, so you can't view the example directly. But if you check the directory out you should get a working example. -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |
|
From: John S. <sp...@is...> - 2005-10-25 14:43:50
|
On Oct 24, 2005, at 11:35 PM, chimpanzee wrote: > Hi, > > I am wondering if this can be added to the schema validator. > Currently, I > use various schemas to validate a "big" dictionary. Each schema > contains > only part of the fields in the dict and the big dict may not have > some of > the fields in the schema. And I don't want the schema to fill in > the missing > fields. In a sense, I want to use the schema to : > > validate the fields you know of about their content validity. I don't think I understand your question so my answer is probably way off. Do you want to use MySchema(allow_extra_fields=True) perhaps? Setting allow_extra_fields to True makes the schema ignore things it doesn't know about. |
|
From: chimpanzee <bo...@gm...> - 2005-10-25 03:35:58
|
Hi, I am wondering if this can be added to the schema validator. Currently, I use various schemas to validate a "big" dictionary. Each schema contains only part of the fields in the dict and the big dict may not have some of the fields in the schema. And I don't want the schema to fill in the missin= g fields. In a sense, I want to use the schema to : validate the fields you know of about their content validity. |
|
From: Ian B. <ia...@co...> - 2005-10-24 19:31:12
|
So, here's my summary of what's in FormEncode now... > * The name and URL of the package and/or repositories FormEncode trunk (may have gotten in 0.2.3 or something, but not intentionally): http://svn.colorstudy.com/FormEncode/trunk/formencode/ > * If it is embedded in another project, where in the project to look > (i.e., the module name(s)) In formencode.fields and formencode.formgen > * Any URLs of examples or docs Nope, none. > Some additional commentary would also be helpful, like: > > * What are your design goals? Haven't figured that out entirely yet. I want to support repeating fields, WHAT-WG Web Forms 2.0 style. I want forms and fields to be unified, in the same way that FormEncode validators and schemas are unified. At the same time, treating both cases the same for layout is insufficient. I'm also very concerned (and try to address) that there be a smooth curve from highly automated forms (like CakeWalk would use) to highly customized forms (like you'd write without using any form generator). The same form can progress from one to the other over time (usually away from automation). > * Does it have any novel features you'd like to point out? Covered below, I suppose... > * How does it deal with exceptional cases, and developer/designer > tweaking of forms? The generated forms are mutable objects. You can go in and tweak them, e.g.: form.fields['name']['style'] += '; width: 100%' Or at least something like that. Also, it should be possible to unpack the objects (like that form) and lay them out manually in a template. The generated fields *aren't* powerful, so you can use them in part or not at all, without changing around other parts of the code. > * Does it have any fancy widgets (e.g., Javascript)? Not at this point, except maybe a color selector. The design does allow for this, though, by trying to generate both a form and a validation schema; the validation schema only applies to the specific form, not the underlying thing that is being created/updated (which may have its own schema). The schema can be used to present the results of a set of HTML fields as a single value. E.g., if you had dropdowns for day, month, and year, the schema could turn that into a date. Not that you should have such dropdowns, because those suck. But you could. > * Presumably it uses FormEncode; to what degree? Does it use htmlfill? > Does it integrate specifically with the validation in any way? It doesn't do form filling, so htmlfill is expected to be used. It doesn't really integrate well with validation yet, especially error displaying (not being particularly compatible with htmlfill in this respect). I'm not 100% sure about htmlfill and the form:error stuff. At the same time, I have a strong intuition that htmlfill (in concept if not necessarily implementation) is really important to keeping form generation workable. > * Thoughts on the future? Is this a prototype or a serious library? Are > you looking to merge it with something else? Despite its presence in FormEncode, this should not be considered a stable library or interface, or the last word on form generation with FormEncode. It's just where I put stuff. This is very very alpha, i.e., not even usable. There are some latent capabilities in FormEncode that I'm worried some other projects might not allow to be revealed, and I have some opinions on this stuff in general, but at the same time I recognize that I'm too overcommitted to actually move this stuff forward very efficiently. > * Any special SQLObject integration? Extensible integration? General > CRUDiness? It does have some SQLObject integration, using RuleDispatch (generic functions). SQLObject is just one case, so it should be generally extensible, without modifying the library at all. Also, specialized rules can be used to tweak the generated forms. It includes a context object, which can be a holder for arbitrary attributes that can be used in specialization. This offers a second escape for someone who wants to make small changes to the form without digging deep into the framework. E.g., if you want to globally make a your Address.street column display as a textarea, you can make a rule that applies to just that one column. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |