Merged with intertwingly...

This commit is contained in:
Morten Frederiksen 2007-03-04 15:21:44 +01:00
commit 1f79279f6c
7 changed files with 39 additions and 6 deletions

View File

@ -38,6 +38,7 @@
<li><a href="http://bitworking.org/projects/httplib2/">httplib2</a></li> <li><a href="http://bitworking.org/projects/httplib2/">httplib2</a></li>
<li><a href="http://www.w3.org/TR/xslt">XSLT</a></li> <li><a href="http://www.w3.org/TR/xslt">XSLT</a></li>
<li><a href="http://www.gnu.org/software/sed/manual/html_mono/sed.html">sed</a></li> <li><a href="http://www.gnu.org/software/sed/manual/html_mono/sed.html">sed</a></li>
<li><a href="http://www.djangoproject.com/documentation/templates/">Django templates</a></li>
</ul> </ul>
</li> </li>
<li>Credits and License <li>Credits and License

View File

@ -107,6 +107,15 @@ not yet ported to the newer python so Venus will be less featureful.
<blockquote><pre>sudo apt-get install bzr python2.4-librdf</pre></blockquote> <blockquote><pre>sudo apt-get install bzr python2.4-librdf</pre></blockquote>
<h3 id="windows">Windows instructions</h3>
<p>
htmltmpl templates (and Django too, since it currently piggybacks on
the htmltmpl implementation) on Windows require
the <a href="http://sourceforge.net/projects/pywin32/">pywin32</a>
module.
</p>
<h3 id="python22">Python 2.2 instructions</h3> <h3 id="python22">Python 2.2 instructions</h3>
<p>If you are running Python 2.2, you may also need to install <a href="http://pyxml.sourceforge.net/">pyxml</a>. If the <p>If you are running Python 2.2, you may also need to install <a href="http://pyxml.sourceforge.net/">pyxml</a>. If the

View File

@ -115,6 +115,11 @@ Item.</p>
able to iterate through them. able to iterate through them.
</p> </p>
<p>
You also have access to the <code>Config</code> dictionary, which contains
the Venus configuration variables from your <code>.ini</code> file.
</p>
<p> <p>
If you lose your way and want to introspect all the variable in the If you lose your way and want to introspect all the variable in the
context, there's the useful <code>{% debug %}</code> template tag. context, there's the useful <code>{% debug %}</code> template tag.

View File

@ -33,6 +33,7 @@ def run(script, doc, output_file=None, options={}):
# datatype converters # datatype converters
context = Context() context = Context()
context.update(tmpl.template_info(doc)) context.update(tmpl.template_info(doc))
context['Config'] = config.planet_options()
t = get_template(script) t = get_template(script)
if output_file: if output_file:

View File

@ -0,0 +1 @@
{{ Config.name }}

View File

@ -26,9 +26,18 @@ class DjangoFilterTests(unittest.TestCase):
os.path.realpath('tests/data/filter/django/title.html.dj'), input) os.path.realpath('tests/data/filter/django/title.html.dj'), input)
self.assertEqual(results, "Atom-Powered Robots Run Amok\n") self.assertEqual(results, "Atom-Powered Robots Run Amok\n")
def test_django_config_context(self):
config.load('tests/data/filter/django/test.ini')
feed = open('tests/data/filter/django/test.xml')
input = feed.read(); feed.close()
results = dj.run(
os.path.realpath('tests/data/filter/django/config.html.dj'), input)
self.assertEqual(results, "Django on Venus\n")
try: try:
from django.conf import settings from django.conf import settings
except ImportError: except ImportError:
logger.warn("Django is not available => can't test django filters") logger.warn("Django is not available => can't test django filters")
del DjangoFilterTests.test_django_filter for method in dir(DjangoFilterTests):
del DjangoFilterTests.test_django_item_title if method.startswith('test_'): delattr(DjangoFilterTests,method)

View File

@ -111,9 +111,16 @@ class FilterTests(unittest.TestCase):
try: try:
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
sed=Popen(['sed','--version'],stdout=PIPE,stderr=PIPE) _no_sed = False
sed.communicate() try:
if sed.returncode != 0: sed = Popen(['sed','--version'],stdout=PIPE,stderr=PIPE)
sed.communicate()
if sed.returncode != 0:
_no_sed = True
except WindowsError:
_no_sed = True
if _no_sed:
logger.warn("sed is not available => can't test stripAd_yahoo") logger.warn("sed is not available => can't test stripAd_yahoo")
del FilterTests.test_stripAd_yahoo del FilterTests.test_stripAd_yahoo