Re: bug? using :import from within :execute
Bram Moolenaar <[email protected]> Fri, 10 Sep 2004 13:08:30 +0200
| Newsgroups | gmane.comp.tools.aap.user |
|---|---|
| Message-ID | <[email protected]> |
Tim Hemel wrote:
> It turned out that in my real version of this problem it still was
> not solved. I patched Scope.py, in the function get_build_recdict()
> I changed the following code:
>
> # Add the user scopes.
> for n in recdict["_top"].user_scope_names:
> new_recdict[n] = recdict[n]
>
> to:
>
> # Add the user scopes.
> for n in recdict["_top"].user_scope_names:
> new_recdict[n] = recdict.get(n)
>
> which is also not the most beautiful solution, but it seems to work
> now.
OK, that is a workaround. Although it's probably better to check if the
key exists, before trying to copy it. That avoids a "None" entry that
may cause problems later.
I'm not sure what the real solution has to be. The module scope m_taptu
should be available everywhere, once the module has been imported. It's
not clear to me why one recdict (scope of a recipe or command block)
doesn't have it. I'll give a warning for when it previously went wrong,
otherwise we might forget about this problem.
for n in recdict["_top"].user_scope_names:
i = recdict.get(n)
if i is None:
msg_warning(recdict, _('get_build_recdict(): "%s" scope missing') % n)
else:
new_recdict[n] = i
--
TALL KNIGHT: When you have found the shrubbery, then you must cut down the
mightiest tree in the forest ... with a herring.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php