djangosnippets.org: Latest snippets posted by phxxhttps://djangosnippets.org/users/phxx/2010-06-20T09:04:49.088575-05:00phxxPython-like string interpolation in Javascript
2010-06-20T09:04:49.088575-05:00phxxhttps://djangosnippets.org/snippets/2074/<p>Provides python-like string interpolation.
It supports value interpolation either by keys of a dictionary or
by index of an array.</p>
<p>Examples:</p>
<pre><code> interpolate("Hello %s.", ["World"]) == "Hello World."
interpolate("Hello %(name)s.", {name: "World"}) == "Hello World."
interpolate("Hello %%.", {name: "World"}) == "Hello %."
</code></pre>
<p>This version doesn't do any type checks and doesn't …</p>
Freely redistributableDefault settings for a app
2008-06-12T09:16:53.911498-05:00phxxhttps://djangosnippets.org/snippets/796/<p>Save this as conf.py in the app's directory. Now you can do <code>from myapp.conf import settings</code>.</p>
<p>You can access from the imported object every item of your settings.py including the default settings of myapp. Though you don't have to define every setting in settings.py you use in your app. …</p>
Freely redistributable