Re: $target contains attributes
Bram Moolenaar <[email protected]> Sat, 19 Jun 2004 21:28:03 +0200
| Newsgroups | gmane.comp.tools.aap.user |
|---|---|
| Message-ID | <[email protected]> |
Tim Hemel wrote:
> I have encountered a little problem when making a web page publishing recipe.
>
> I have the following recipe (stripped):
>
> ------------
> :rule target/%: {buildcheck = $commands $MenuItems} templates/%.tpl
> :print $target
> :python
> from GWS.Templater import *
> t = TaptuTemplater(source_list[0])
> _no.setAapVars(t)
> t.setVar("title","Some title")
> print _no.target
> _no.outputToFile(t,_no.target)
>
> Pages = `[ "target/%s.html" % i for i in expand2list(MenuItems)]` target/1.html target/2.html
> Files = target/index.html target/style.css $Pages
>
> all: $Files
>
> :attr { publish = scp://[email protected]//zzz/%file% } $Files
> ---------------
>
> If I run the recipe, it gives the following output:
>
>
> target/index.html{publish=scp://[email protected]//zzz/%file%}
> target/index.html{publish=scp://[email protected]//zzz/%file%}
> Aap: Error in recipe "/some/path/main.aap" line 56: IOError: [Errno 2] No such file or directory: 'target/index.html{publish=scp://[email protected]//zzz/%file%}'
>
> Clearly, the $target variable contains the attribute in its string. Is there a
> Python function to remove this, or another variable that can be used instead,
> such as $target_path ?
It's not exactly clear where the error message comes from. Is it in the
Python code?
In Aap commands you can use $-varname to get the variable value without
the attributes. In Python you can use var2list(_no.varname)[0].
--
hundred-and-one symptoms of being an internet addict:
212. Your Internet group window has more icons than your Accessories window.
/// 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 The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND