tarbell-project/tarbell

Tarbell shell

eyeseast opened this issue · 0 comments

Here's a thing I do a lot:

>>> from tarbell.site import TarbellApp

# create a site
>>> site = TarbellApp('.')

# get a request context
>>> ctx = site.app.test_request_context()
>>> ctx.push()

# run through the pre-request hooks, so g.current_site works
>>> site.app.preprocess_request()

# now I can do things with site data
>>> context = site.get_context()
>>> print(context['title'])

It would be really nice to package all those steps into a little shell script, so I could run something like:

tarbell shell

And get:

>>> site
<tarbell.app.TarbellSite instance at 0x...>