[Zope] import error

J. Cameron Cooper jccooper at jcameroncooper.com
Mon Nov 3 23:10:44 EST 2003


>I must be having a brain freeze. Someone please point out the error of my
>ways :) When importing the following module called PValidation I get an
>error.
>
>### begin module PValidation.py
>from DateTime import DateTime
>
>def validateMoney(input):
>	""" Strip leading $ from input and make sure it can be
>	converted to a float datatype otherwise return 0 """
>
>	if input == '': input = '0'
>	if input[0] == '$': input = input[1:]
>	try: float(input)
>	except: input = '0'
>	return input
>
>def validateDate(input):
>	""" If input can be formated by DateTime return formatted
>	text otherwise return an empty string """
>
>	try: results = DateTime(input).strftime('%m/%d/%Y')
>	except: results = ''
>	return results
>### End Module
>  
>
Unless it's in your first line (the DateTime import), I don't think it 
has anything to do with that file or the import statement itself, as I 
was able to do it outside of Zope (which is why I had to get rid of the 
first line.)

Perhaps there's something else named validateDate already? What happens 
when you split it into two imports? What about renaming the function?

          --jcc

-- 
"My point and period will be throughly wrought,
Or well or ill, as this day's battle's fought."





More information about the Zope mailing list