Re: internal error

calmar <[email protected]> Sun, 18 Dec 2005 19:11:26 +0100
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
On Sun, Dec 18, 2005 at 02:35:19PM +0100, Bram Moolenaar wrote:

Hi Bram,

> > 
> > Yeah, that patch catches it.
> > 
> > There seems to be a bad(probably good anyway?) thing about it:
> > 
> >         tmpstring = _no.$(match)_title
> >         @try:
> >         @   title = eval(_no.tmpstring)
> >         @except:
> >         @   title = ""
> >         :print $title
> > 
> > that does not work anymore, because the error gets catched.
> 
> When I try this the "except:" part is done, which is what was intended,
> right?

Well, when the variable is definded, it should set title to it,
and it also does that.

In the above example, I wrote _no.tmpstring, what is wrong -
It should be 'tmpstring' what itself should
be e.g. _no.filename_title, and that should finally
evaluate to what it's defined (if is it defined) in the recipe.

Well that's the working recipe:

http://www.calmar.ws/aap/ristoranteoldtimer_aap.html

> You can use has_key():
> 
> 	@if _no.has_key("varname"):

I see, that also works nice:

    tmpstring = $(match)_title
    @if _no.has_key(tmpstring):
    @  title = eval ( "_no." + tmpstring )
    @else:
    @  title = ""


the 'original' one works with and without your patch (to catch
the internal Error message):

    tmpstring = _no.$(match)_title
    @try:
    @  title = eval( tmpstring )
    @except KeyError:
    @  title = ""

Everything is perfect now, here!

Sorry, I was confused and wrote some rubbish about: 'it
would not work with the patch,...', since it does work in both
ways.

I will check once more an issue bevore posting it in the future.

Thanks a lot!
marco


-- 
  calmar

          (o_  It rocks: LINUX + Command-Line-Interface
          //\
          V_/_                     http://www.calmar.ws


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click