Seth, Seth Rosenblum wrote:
I'm using the velocity engine with ParseErrorException throwing turned on because it greatly simplifies unit testing, as it just checks that every value on the page has been filled in. However, I'd like velocity to not throw an exception when I pass it a quiet reference e.g. $isNull should throw an exception, but $!isNull should just resolve to being empty. Is there a way to do this?
How about #if($isNull) (nothing) #else $!isNull #end This is quite verbose, but it will get the job done.I've always been a proponent of something like ReferenceTools that would allow you to do things like directly check for null and false (because null == false in VTL) so you wouldn't have to use tricks like these to get around this behavior. I've just been too lazy to do anything about it so far ;)
-chris
signature.asc
Description: OpenPGP digital signature
