Skip to content

Commit

Permalink
Fixed #2205:
Browse files Browse the repository at this point in the history
 * repoze.what predicates are "booleanized" by default.
 * Increased the required version number of repoze.what-pylons.
 * Added the repoze.what predicates module to the set of TG variables in the template.

--HG--
extra : convert_revision : svn%3A77541ad4-5f01-0410-9ede-a1b63cd9a898/trunk%406347
  • Loading branch information
Gustavo committed Feb 19, 2009
1 parent d34a195 commit c00b58f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -37,7 +37,7 @@
'WebFlash >= 0.1a7',
'ToscaWidgets>=0.9',
'WebError',
'repoze.what-pylons >= 1.0b2',
'repoze.what-pylons >= 1.0rc1',
'repoze.tm2',
'TurboJson',
],
Expand Down
4 changes: 4 additions & 0 deletions tg/configuration.py
Expand Up @@ -433,6 +433,10 @@ def add_error_middleware(self, global_conf, app):
def add_auth_middleware(self, app):
"""Configure authentication and authorization."""
from repoze.what.plugins.quickstart import setup_sql_auth
from repoze.what.plugins.pylonshq import booleanize_predicates

# Predicates booleanized:
booleanize_predicates()

# Configuring auth logging:
if 'log_stream' not in self.sa_auth:
Expand Down
14 changes: 11 additions & 3 deletions tg/render.py
@@ -1,10 +1,14 @@
from urllib import quote_plus

from genshi import XML
from pylons import (app_globals, config, session, tmpl_context, request,
response, templating)
from repoze.what import predicates

import tg
from tg.util import get_dotted_filename
from tg.configuration import Bunch
from genshi import XML
from urllib import quote_plus


class MissingRendererError(Exception):
def __init__(self, template_engine):
Expand Down Expand Up @@ -60,6 +64,9 @@ def _get_tg_vars():
the app's config object
auth_stack_enabled
A boolean that determines if the auth stack is present in the environment
predicates
The :mod:`repoze.what.predicates` module.
"""
# TODO: Implement user_agent and other missing features.
tg_vars = Bunch(
Expand All @@ -84,7 +91,8 @@ def _get_tg_vars():
errors = getattr(tmpl_context, "form_errors", {}),
inputs = getattr(tmpl_context, "form_values", {}),
request = tg.request,
auth_stack_enabled = 'repoze.who.plugins' in tg.request.environ
auth_stack_enabled = 'repoze.who.plugins' in tg.request.environ,
predicates = predicates,
)

# TODO: we should actually just get helpers from the package's helpers
Expand Down

0 comments on commit c00b58f

Please sign in to comment.