Compare commits
No commits in common. "2c2d35554f2b2d48ee6b8ad324e4c93363ba99e1" and "c1a14b48691896ae22e9a1eecddb7f48668f1fb6" have entirely different histories.
2c2d35554f
...
c1a14b4869
14 changed files with 26 additions and 16 deletions
|
@ -10,5 +10,3 @@ enable=
|
|||
too-many-branches,
|
||||
too-many-instance-attributes,
|
||||
too-many-return-statements,
|
||||
unused-import,
|
||||
unused-variable,
|
||||
|
|
|
@ -182,7 +182,7 @@ def main(global_config, **settings):
|
|||
``poser.web.app:main``), similar to this one but with additional
|
||||
views and other config.
|
||||
"""
|
||||
wutta_config = make_wutta_config(settings) # pylint: disable=unused-variable
|
||||
wutta_config = make_wutta_config(settings)
|
||||
pyramid_config = make_pyramid_config(settings)
|
||||
|
||||
pyramid_config.include("wuttaweb.static")
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
Auth Utility Logic
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from pyramid.authentication import SessionAuthenticationHelper
|
||||
from pyramid.request import RequestLocalCache
|
||||
from pyramid.security import remember, forget
|
||||
|
|
|
@ -870,6 +870,7 @@ class Form: # pylint: disable=too-many-instance-attributes
|
|||
generating it automatically if necessary.
|
||||
"""
|
||||
if not hasattr(self, "deform_form"):
|
||||
model = self.app.model
|
||||
schema = self.get_schema()
|
||||
kwargs = {}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import uuid as _uuid
|
|||
import colander
|
||||
import sqlalchemy as sa
|
||||
|
||||
from wuttjamaican.db.model import Person
|
||||
from wuttjamaican.conf import parse_list
|
||||
|
||||
from wuttaweb.db import Session
|
||||
|
@ -383,6 +384,7 @@ class ObjectRef(colander.SchemaType):
|
|||
return value
|
||||
|
||||
# fetch object from DB
|
||||
model = self.app.model
|
||||
obj = None
|
||||
if isinstance(value, _uuid.UUID):
|
||||
obj = self.session.get(self.model_class, value)
|
||||
|
@ -605,7 +607,7 @@ class Permissions(WuttaSet):
|
|||
|
||||
if "values" not in kwargs:
|
||||
values = []
|
||||
for group in self.permissions.values():
|
||||
for gkey, group in self.permissions.items():
|
||||
for pkey, perm in group["perms"].items():
|
||||
values.append((pkey, perm["label"]))
|
||||
kwargs["values"] = values
|
||||
|
|
|
@ -47,7 +47,7 @@ import os
|
|||
|
||||
import colander
|
||||
import humanize
|
||||
from deform.widget import ( # pylint: disable=unused-import
|
||||
from deform.widget import (
|
||||
Widget,
|
||||
TextInputWidget,
|
||||
TextAreaWidget,
|
||||
|
@ -64,6 +64,8 @@ from webhelpers2.html import HTML
|
|||
|
||||
from wuttjamaican.conf import parse_list
|
||||
|
||||
from wuttaweb.db import Session
|
||||
|
||||
|
||||
class ObjectRefWidget(SelectWidget):
|
||||
"""
|
||||
|
@ -467,7 +469,7 @@ class PermissionsWidget(WuttaCheckboxChoiceWidget):
|
|||
|
||||
if "values" not in kw:
|
||||
values = []
|
||||
for group in self.permissions.values():
|
||||
for gkey, group in self.permissions.items():
|
||||
for pkey, perm in group["perms"].items():
|
||||
values.append((pkey, perm["label"]))
|
||||
kw["values"] = values
|
||||
|
|
|
@ -25,6 +25,7 @@ Base grid classes
|
|||
"""
|
||||
|
||||
import functools
|
||||
import json
|
||||
import logging
|
||||
import warnings
|
||||
from collections import namedtuple, OrderedDict
|
||||
|
@ -37,7 +38,9 @@ from paginate_sqlalchemy import SqlalchemyOrmPage
|
|||
from pyramid.renderers import render
|
||||
from webhelpers2.html import HTML
|
||||
|
||||
from wuttaweb.db import Session
|
||||
from wuttaweb.util import FieldList, get_model_fields, make_json_safe
|
||||
from wuttjamaican.util import UNSPECIFIED
|
||||
from wuttjamaican.db.util import UUID
|
||||
from wuttaweb.grids.filters import default_sqlalchemy_filters, VerbNotSupported
|
||||
|
||||
|
|
|
@ -54,8 +54,4 @@ This module contains the following references:
|
|||
from webhelpers2.html import *
|
||||
from webhelpers2.html.tags import *
|
||||
|
||||
from wuttaweb.util import ( # pylint: disable=unused-import
|
||||
get_liburl,
|
||||
get_csrf_token,
|
||||
render_csrf_token as csrf_token,
|
||||
)
|
||||
from wuttaweb.util import get_liburl, get_csrf_token, render_csrf_token as csrf_token
|
||||
|
|
|
@ -39,6 +39,7 @@ from pyramid.renderers import get_renderer
|
|||
from webhelpers2.html import HTML, tags
|
||||
|
||||
from wuttjamaican.util import resource_path
|
||||
from wuttaweb.db import Session
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -605,7 +606,7 @@ def make_json_safe(value, key=None, warn=True):
|
|||
# ensure JSON-compatibility, warn if problems
|
||||
try:
|
||||
json.dumps(value)
|
||||
except TypeError:
|
||||
except TypeError as error:
|
||||
if warn:
|
||||
prefix = "value"
|
||||
if key:
|
||||
|
|
|
@ -27,6 +27,7 @@ Common Views
|
|||
import logging
|
||||
|
||||
import colander
|
||||
from pyramid.renderers import render
|
||||
|
||||
from wuttaweb.views import View
|
||||
from wuttaweb.forms import widgets
|
||||
|
|
|
@ -35,7 +35,7 @@ from pyramid.renderers import render_to_response
|
|||
from webhelpers2.html import HTML
|
||||
|
||||
from wuttaweb.views import View
|
||||
from wuttaweb.util import get_form_data, render_csrf_token
|
||||
from wuttaweb.util import get_form_data, get_model_fields, render_csrf_token
|
||||
from wuttaweb.db import Session
|
||||
from wuttaweb.progress import SessionProgress
|
||||
from wuttjamaican.util import get_class_hierarchy
|
||||
|
|
|
@ -285,8 +285,8 @@ class RoleView(MasterView):
|
|||
available = self.wutta_permissions
|
||||
permissions = form.validated["permissions"]
|
||||
|
||||
for group in available.values():
|
||||
for pkey in group["perms"]:
|
||||
for gkey, group in available.items():
|
||||
for pkey, perm in group["perms"].items():
|
||||
if pkey in permissions:
|
||||
auth.grant_permission(role, pkey)
|
||||
else:
|
||||
|
|
|
@ -156,7 +156,7 @@ class AppInfoView(MasterView):
|
|||
return self.config.get(f"wuttaweb.{key}")
|
||||
|
||||
weblibs = self.get_weblibs()
|
||||
for key in weblibs:
|
||||
for key, title in weblibs.items():
|
||||
|
||||
simple_settings.append(
|
||||
{
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
Views for users
|
||||
"""
|
||||
|
||||
import colander
|
||||
|
||||
from wuttjamaican.db.model import User
|
||||
from wuttaweb.views import MasterView
|
||||
from wuttaweb.forms import widgets
|
||||
|
@ -175,6 +177,7 @@ class UserView(MasterView):
|
|||
|
||||
def objectify(self, form): # pylint: disable=empty-docstring
|
||||
""" """
|
||||
model = self.app.model
|
||||
auth = self.app.get_auth_handler()
|
||||
data = form.validated
|
||||
|
||||
|
@ -271,6 +274,7 @@ class UserView(MasterView):
|
|||
|
||||
:rtype: :class:`~wuttaweb.grids.base.Grid`
|
||||
"""
|
||||
model = self.app.model
|
||||
route_prefix = self.get_route_prefix()
|
||||
|
||||
grid = self.make_grid(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue