Add webhelpers2 dependency, use it for most things

still using webhelpers for certain things yet, hopefully can get rid of that soon
This commit is contained in:
Lance Edgar 2017-07-06 20:13:42 -05:00
parent 5bded89466
commit 8014e60d14
32 changed files with 61 additions and 59 deletions

View file

@ -41,6 +41,7 @@ extensions = [
intersphinx_mapping = { intersphinx_mapping = {
# TODO: Add this back, when the FA site is back online... # TODO: Add this back, when the FA site is back online...
#'formalchemy': ('http://docs.formalchemy.org/formalchemy/', None), #'formalchemy': ('http://docs.formalchemy.org/formalchemy/', None),
'webhelpers2': ('https://webhelpers2.readthedocs.io/en/latest/', None),
} }
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -94,6 +94,7 @@ requires = [
'transaction', # 1.2.0 'transaction', # 1.2.0
'waitress', # 0.8.1 'waitress', # 0.8.1
'WebHelpers', # 1.3 'WebHelpers', # 1.3
'WebHelpers2', # 2.0
'WTForms', # 2.1 'WTForms', # 2.1
'zope.sqlalchemy', # 0.7 'zope.sqlalchemy', # 0.7

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -30,7 +30,7 @@ from rattail.core import Object
import formalchemy as fa import formalchemy as fa
from pyramid.renderers import render from pyramid.renderers import render
from webhelpers.html import HTML, tags from webhelpers2.html import HTML, tags
from tailbone.db import Session from tailbone.db import Session

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -31,7 +31,7 @@ import stat
import random import random
import formalchemy as fa import formalchemy as fa
from webhelpers.html import tags, HTML from webhelpers2.html import tags, HTML
from tailbone.forms.renderers import FileFieldRenderer as BaseFileFieldRenderer from tailbone.forms.renderers import FileFieldRenderer as BaseFileFieldRenderer

View file

@ -34,7 +34,7 @@ from rattail.util import pretty_quantity
import formalchemy as fa import formalchemy as fa
from formalchemy import fields as fa_fields, helpers as fa_helpers from formalchemy import fields as fa_fields, helpers as fa_helpers
from pyramid.renderers import render from pyramid.renderers import render
from webhelpers.html import HTML, tags from webhelpers2.html import HTML, tags
from tailbone.util import pretty_datetime, raw_datetime from tailbone.util import pretty_datetime, raw_datetime

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
@ -27,7 +27,7 @@ Customer order field renderers
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
import formalchemy as fa import formalchemy as fa
from webhelpers.html import tags from webhelpers2.html import tags
class CustomerOrderFieldRenderer(fa.fields.SelectFieldRenderer): class CustomerOrderFieldRenderer(fa.fields.SelectFieldRenderer):

View file

@ -27,7 +27,7 @@ Employee Field Renderers
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
import six import six
from webhelpers.html import tags from webhelpers2.html import tags
from tailbone.forms.renderers import AutocompleteFieldRenderer from tailbone.forms.renderers import AutocompleteFieldRenderer

View file

@ -28,7 +28,7 @@ from __future__ import unicode_literals, absolute_import
import six import six
import formalchemy as fa import formalchemy as fa
from webhelpers.html import tags, HTML from webhelpers2.html import tags, HTML
from tailbone.forms.renderers.common import AutocompleteFieldRenderer from tailbone.forms.renderers.common import AutocompleteFieldRenderer

View file

@ -33,7 +33,7 @@ from rattail.db.util import maxlen
import formalchemy as fa import formalchemy as fa
from formalchemy import TextFieldRenderer from formalchemy import TextFieldRenderer
from formalchemy.fields import SelectFieldRenderer from formalchemy.fields import SelectFieldRenderer
from webhelpers.html import tags, literal from webhelpers2.html import tags, literal
from tailbone.forms.renderers.common import AutocompleteFieldRenderer from tailbone.forms.renderers.common import AutocompleteFieldRenderer
from tailbone.util import pretty_datetime from tailbone.util import pretty_datetime

View file

@ -27,7 +27,7 @@ Store Field Renderers
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
from formalchemy.fields import SelectFieldRenderer from formalchemy.fields import SelectFieldRenderer
from webhelpers.html import tags from webhelpers2.html import tags
class StoreFieldRenderer(SelectFieldRenderer): class StoreFieldRenderer(SelectFieldRenderer):

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
@ -30,7 +30,7 @@ from rattail.db import model
from rattail.db.auth import has_permission, administrator_role from rattail.db.auth import has_permission, administrator_role
import formalchemy import formalchemy
from webhelpers.html import HTML, tags from webhelpers2.html import HTML, tags
from tailbone.db import Session from tailbone.db import Session

View file

@ -27,7 +27,7 @@ Vendor Field Renderers
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
from formalchemy.fields import SelectFieldRenderer from formalchemy.fields import SelectFieldRenderer
from webhelpers.html import tags from webhelpers2.html import tags
from tailbone.forms.renderers.common import AutocompleteFieldRenderer from tailbone.forms.renderers.common import AutocompleteFieldRenderer

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -30,8 +30,7 @@ from rattail.util import prettify
import pyramid_simpleform import pyramid_simpleform
from pyramid_simpleform import renderers from pyramid_simpleform import renderers
from webhelpers.html import tags from webhelpers2.html import tags, HTML
from webhelpers.html import HTML
from tailbone.forms import Form from tailbone.forms import Form

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -30,7 +30,7 @@ from rattail.db.api import get_setting, save_setting
from rattail.util import prettify from rattail.util import prettify
from pyramid.renderers import render from pyramid.renderers import render
from webhelpers.html import HTML, tags from webhelpers2.html import HTML, tags
from webhelpers.html.builder import format_attrs from webhelpers.html.builder import format_attrs
from tailbone.db import Session from tailbone.db import Session

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -39,7 +39,7 @@ from rattail.util import prettify
from pyramid_simpleform import Form from pyramid_simpleform import Form
from pyramid_simpleform.renderers import FormRenderer from pyramid_simpleform.renderers import FormRenderer
from webhelpers.html import HTML, tags from webhelpers2.html import HTML, tags
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -95,7 +95,9 @@ class ChoiceValueRenderer(FilterValueRenderer):
self.choices = choices self.choices = choices
def render(self, value=None, **kwargs): def render(self, value=None, **kwargs):
return tags.select(self.name, [value], self.choices, **kwargs) options = tags.Options([tags.Option(label, value=value)
for value, label in self.choices])
return tags.select(self.name, [value], options, **kwargs)
class EnumValueRenderer(ChoiceValueRenderer): class EnumValueRenderer(ChoiceValueRenderer):
@ -727,7 +729,7 @@ class GridFiltersFormRenderer(FormRenderer):
def tag(self, *args, **kwargs): def tag(self, *args, **kwargs):
""" """
Convenience method which passes all args to the Convenience method which passes all args to the
:func:`webhelpers:webhelpers.HTML.tag()` function. :meth:`webhelpers2:webhelpers2.html.builder.HTMLBuilder.tag()` method.
""" """
return HTML.tag(*args, **kwargs) return HTML.tag(*args, **kwargs)

View file

@ -26,7 +26,7 @@ Mobile Grids
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
from webhelpers.html import HTML from webhelpers2.html import HTML
from tailbone.newgrids import AlchemyGrid from tailbone.newgrids import AlchemyGrid

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -31,10 +31,10 @@ import datetime
import pytz import pytz
import humanize import humanize
from webhelpers.html import HTML, tags
from rattail.time import timezone, make_utc from rattail.time import timezone, make_utc
from webhelpers2.html import HTML, tags
def csrf_token(request, name='_csrf'): def csrf_token(request, name='_csrf'):
""" """

View file

@ -31,7 +31,7 @@ from rattail.db.auth import authenticate_user, set_user_password
import formencode as fe import formencode as fe
from pyramid.httpexceptions import HTTPForbidden from pyramid.httpexceptions import HTTPForbidden
from pyramid_simpleform import Form from pyramid_simpleform import Form
from webhelpers.html import tags, literal from webhelpers2.html import tags, literal
from tailbone import forms from tailbone import forms
from tailbone.db import Session from tailbone.db import Session

View file

@ -47,7 +47,7 @@ from pyramid import httpexceptions
from pyramid.renderers import render_to_response from pyramid.renderers import render_to_response
from pyramid.response import FileResponse from pyramid.response import FileResponse
from pyramid_simpleform import Form from pyramid_simpleform import Form
from webhelpers.html import HTML, tags from webhelpers2.html import HTML, tags
from tailbone import forms, newgrids as grids from tailbone import forms, newgrids as grids
from tailbone.db import Session from tailbone.db import Session

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -35,7 +35,7 @@ from rattail.bouncer.config import get_profile_keys
import formalchemy import formalchemy
from pyramid.response import FileResponse from pyramid.response import FileResponse
from webhelpers.html import literal from webhelpers2.html import literal
from tailbone import newgrids as grids from tailbone import newgrids as grids
from tailbone.db import Session from tailbone.db import Session

View file

@ -34,7 +34,7 @@ from rattail.util import OrderedDict
import formalchemy as fa import formalchemy as fa
import formencode as fe import formencode as fe
from webhelpers.html import tags from webhelpers2.html import tags
from tailbone import forms from tailbone import forms
from tailbone.db import Session from tailbone.db import Session

View file

@ -39,7 +39,7 @@ from rattail.time import localtime
import formalchemy as fa import formalchemy as fa
from pyramid import httpexceptions from pyramid import httpexceptions
from pyramid.renderers import get_renderer, render_to_response, render from pyramid.renderers import get_renderer, render_to_response, render
from webhelpers.html import HTML, tags from webhelpers2.html import HTML, tags
from tailbone import forms, newgrids as grids from tailbone import forms, newgrids as grids
from tailbone.views import View from tailbone.views import View

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -36,7 +36,7 @@ from rattail.time import localtime
import formalchemy import formalchemy
from formalchemy.helpers import text_field from formalchemy.helpers import text_field
from pyramid import httpexceptions from pyramid import httpexceptions
from webhelpers.html import tags, HTML from webhelpers2.html import tags, HTML
from tailbone import forms from tailbone import forms
from tailbone.db import Session from tailbone.db import Session

View file

@ -30,7 +30,7 @@ import sqlalchemy as sa
import formalchemy as fa import formalchemy as fa
from pyramid.httpexceptions import HTTPFound, HTTPNotFound from pyramid.httpexceptions import HTTPFound, HTTPNotFound
from webhelpers.html import HTML, tags from webhelpers2.html import HTML, tags
from tailbone import forms from tailbone import forms
from tailbone.views import MasterView, AutocompleteView from tailbone.views import MasterView, AutocompleteView

View file

@ -44,7 +44,7 @@ import wtforms
import formalchemy as fa import formalchemy as fa
from pyramid import httpexceptions from pyramid import httpexceptions
from pyramid.renderers import render_to_response from pyramid.renderers import render_to_response
from webhelpers.html import tags from webhelpers2.html import tags
from tailbone import forms, newgrids as grids from tailbone import forms, newgrids as grids
from tailbone.db import Session from tailbone.db import Session

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -29,7 +29,7 @@ from __future__ import unicode_literals, absolute_import
from rattail.db import model from rattail.db import model
import formalchemy as fa import formalchemy as fa
from webhelpers.html import HTML, tags from webhelpers2.html import HTML, tags
from tailbone import forms from tailbone import forms
from tailbone.db import Session from tailbone.db import Session

View file

@ -37,7 +37,7 @@ from rattail.util import pretty_quantity
import formalchemy as fa import formalchemy as fa
import formencode as fe import formencode as fe
from webhelpers.html import tags from webhelpers2.html import tags
from tailbone import forms from tailbone import forms
from tailbone.views.purchasing import PurchasingBatchView from tailbone.views.purchasing import PurchasingBatchView

View file

@ -33,7 +33,6 @@ from rattail.db.auth import has_permission, administrator_role, guest_role, auth
import formalchemy as fa import formalchemy as fa
from formalchemy.fields import IntegerFieldRenderer from formalchemy.fields import IntegerFieldRenderer
from webhelpers.html import HTML, tags
from tailbone import forms, newgrids as grids from tailbone import forms, newgrids as grids
from tailbone.db import Session from tailbone.db import Session

View file

@ -38,7 +38,7 @@ from rattail.util import pretty_hours, hours_as_decimal
import formencode as fe import formencode as fe
from pyramid_simpleform import Form from pyramid_simpleform import Form
from webhelpers.html import HTML from webhelpers2.html import HTML
from tailbone import forms from tailbone import forms
from tailbone.db import Session from tailbone.db import Session

View file

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
@ -31,7 +31,7 @@ import subprocess
from rattail_tempmon.db import model as tempmon from rattail_tempmon.db import model as tempmon
import formalchemy as fa import formalchemy as fa
from webhelpers.html import HTML, tags from webhelpers2.html import HTML, tags
from tailbone.db import TempmonSession from tailbone.db import TempmonSession
from tailbone.views.tempmon import MasterView from tailbone.views.tempmon import MasterView

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -27,7 +27,7 @@ Common stuff for tempmon views
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
from formalchemy.fields import SelectFieldRenderer from formalchemy.fields import SelectFieldRenderer
from webhelpers.html import tags from webhelpers2.html import tags
from tailbone import views from tailbone import views
from tailbone.db import TempmonSession from tailbone.db import TempmonSession

View file

@ -36,7 +36,7 @@ from rattail.db.auth import guest_role, authenticated_role, set_user_password, h
import wtforms import wtforms
import formalchemy import formalchemy
from formalchemy.fields import SelectFieldRenderer from formalchemy.fields import SelectFieldRenderer
from webhelpers.html import HTML, tags from webhelpers2.html import HTML, tags
from tailbone import forms from tailbone import forms
from tailbone.db import Session from tailbone.db import Session