fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] %(my_var)s or $(my_var)


From: Christian Vest Hansen
Subject: Re: [Fab-user] %(my_var)s or $(my_var)
Date: Sun, 4 May 2008 12:52:05 +0200

Hi Loïc,

The difference is the evaluation time. The %(...)s notation is
evaluated as soon as possible, whereas the $() notation is lazily
evaluated.

This example illustrates the difference:

def test():
    set(var = 'a')
    set(cmd = 'echo %(var)s $(var)')
    set(var = 'b')
    local(get('cmd'))

If you run that as a command with fabric, it will print "a b".

The drawback with the lazy notation is that you can't apply any
formatting rules to it, but you hardly ever need to do that in a
fabrfile anyway so I don't think it's a big issue.


On 5/4/08, Loic d'Anterroches <address@hidden> wrote:
> Hi Christian,
>
>  I am slowly starting to standardize all my deployment scripts to use fab
>  with a standard set of commands. That way I can do:
>
>  $ cd ~/Websites/my.website.com
>  $ fab prod build deploy
>
>  or simply do that in all the folders in ~/Websites to update all my
>  websites in one go.
>
>  It is working great, but I have a small question:
>  What is the difference between %(my_var)s and $(my_var) in the commands?
>  Do they have different way to be interpolated?
>
>  Best regards,
>  loïc
>
>  Note: Great idea the website, you should also link to your relevent blog
>  posts.
>
>  --
>  Pluf PHP5 Framework inspired by Django
>  http://www.pluf.org
>
>
>
>
>  _______________________________________________
>  Fab-user mailing list
>  address@hidden
>  http://lists.nongnu.org/mailman/listinfo/fab-user
>


-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]