Compare commits
	
		
			2 commits
		
	
	
		
			c1a14b4869
			...
			2c2d35554f
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 2c2d35554f | |||
| 8987197856 | 
					 14 changed files with 16 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -10,3 +10,5 @@ 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)
 | 
			
		||||
    wutta_config = make_wutta_config(settings)  # pylint: disable=unused-variable
 | 
			
		||||
    pyramid_config = make_pyramid_config(settings)
 | 
			
		||||
 | 
			
		||||
    pyramid_config.include("wuttaweb.static")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,8 +24,6 @@
 | 
			
		|||
Auth Utility Logic
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
import re
 | 
			
		||||
 | 
			
		||||
from pyramid.authentication import SessionAuthenticationHelper
 | 
			
		||||
from pyramid.request import RequestLocalCache
 | 
			
		||||
from pyramid.security import remember, forget
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -870,7 +870,6 @@ 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,7 +30,6 @@ 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
 | 
			
		||||
| 
						 | 
				
			
			@ -384,7 +383,6 @@ 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)
 | 
			
		||||
| 
						 | 
				
			
			@ -607,7 +605,7 @@ class Permissions(WuttaSet):
 | 
			
		|||
 | 
			
		||||
        if "values" not in kwargs:
 | 
			
		||||
            values = []
 | 
			
		||||
            for gkey, group in self.permissions.items():
 | 
			
		||||
            for group in self.permissions.values():
 | 
			
		||||
                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 (
 | 
			
		||||
from deform.widget import (  # pylint: disable=unused-import
 | 
			
		||||
    Widget,
 | 
			
		||||
    TextInputWidget,
 | 
			
		||||
    TextAreaWidget,
 | 
			
		||||
| 
						 | 
				
			
			@ -64,8 +64,6 @@ from webhelpers2.html import HTML
 | 
			
		|||
 | 
			
		||||
from wuttjamaican.conf import parse_list
 | 
			
		||||
 | 
			
		||||
from wuttaweb.db import Session
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ObjectRefWidget(SelectWidget):
 | 
			
		||||
    """
 | 
			
		||||
| 
						 | 
				
			
			@ -469,7 +467,7 @@ class PermissionsWidget(WuttaCheckboxChoiceWidget):
 | 
			
		|||
 | 
			
		||||
        if "values" not in kw:
 | 
			
		||||
            values = []
 | 
			
		||||
            for gkey, group in self.permissions.items():
 | 
			
		||||
            for group in self.permissions.values():
 | 
			
		||||
                for pkey, perm in group["perms"].items():
 | 
			
		||||
                    values.append((pkey, perm["label"]))
 | 
			
		||||
            kw["values"] = values
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,6 @@ Base grid classes
 | 
			
		|||
"""
 | 
			
		||||
 | 
			
		||||
import functools
 | 
			
		||||
import json
 | 
			
		||||
import logging
 | 
			
		||||
import warnings
 | 
			
		||||
from collections import namedtuple, OrderedDict
 | 
			
		||||
| 
						 | 
				
			
			@ -38,9 +37,7 @@ 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,4 +54,8 @@ This module contains the following references:
 | 
			
		|||
from webhelpers2.html import *
 | 
			
		||||
from webhelpers2.html.tags import *
 | 
			
		||||
 | 
			
		||||
from wuttaweb.util import get_liburl, get_csrf_token, render_csrf_token as csrf_token
 | 
			
		||||
from wuttaweb.util import (  # pylint: disable=unused-import
 | 
			
		||||
    get_liburl,
 | 
			
		||||
    get_csrf_token,
 | 
			
		||||
    render_csrf_token as csrf_token,
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,7 +39,6 @@ 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__)
 | 
			
		||||
| 
						 | 
				
			
			@ -606,7 +605,7 @@ def make_json_safe(value, key=None, warn=True):
 | 
			
		|||
    # ensure JSON-compatibility, warn if problems
 | 
			
		||||
    try:
 | 
			
		||||
        json.dumps(value)
 | 
			
		||||
    except TypeError as error:
 | 
			
		||||
    except TypeError:
 | 
			
		||||
        if warn:
 | 
			
		||||
            prefix = "value"
 | 
			
		||||
            if key:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,6 @@ 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, get_model_fields, render_csrf_token
 | 
			
		||||
from wuttaweb.util import get_form_data, 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 gkey, group in available.items():
 | 
			
		||||
            for pkey, perm in group["perms"].items():
 | 
			
		||||
        for group in available.values():
 | 
			
		||||
            for pkey in group["perms"]:
 | 
			
		||||
                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, title in weblibs.items():
 | 
			
		||||
        for key in weblibs:
 | 
			
		||||
 | 
			
		||||
            simple_settings.append(
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,8 +24,6 @@
 | 
			
		|||
Views for users
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
import colander
 | 
			
		||||
 | 
			
		||||
from wuttjamaican.db.model import User
 | 
			
		||||
from wuttaweb.views import MasterView
 | 
			
		||||
from wuttaweb.forms import widgets
 | 
			
		||||
| 
						 | 
				
			
			@ -177,7 +175,6 @@ class UserView(MasterView):
 | 
			
		|||
 | 
			
		||||
    def objectify(self, form):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
        auth = self.app.get_auth_handler()
 | 
			
		||||
        data = form.validated
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -274,7 +271,6 @@ 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