Remove some more edbob cruft.
This commit is contained in:
parent
9806c7a0a2
commit
8bf292ebac
14 changed files with 136 additions and 124 deletions
|
@ -1,9 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2012 Lance Edgar
|
||||
# Copyright © 2010-2014 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -21,11 +20,12 @@
|
|||
# along with Rattail. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
"""
|
||||
Auth Views
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from pyramid.httpexceptions import HTTPFound
|
||||
from pyramid.security import remember, forget, authenticated_userid
|
||||
|
||||
|
@ -36,7 +36,8 @@ import formencode
|
|||
from pyramid_simpleform import Form
|
||||
from ..forms.simpleform import FormRenderer
|
||||
|
||||
import edbob
|
||||
from rattail.time import localtime
|
||||
|
||||
from ..db import Session
|
||||
from rattail.db.auth import authenticate_user, set_user_password
|
||||
|
||||
|
@ -85,20 +86,13 @@ def login(request):
|
|||
form.data['username'],
|
||||
form.data['password'])
|
||||
if user:
|
||||
request.session.flash("%s logged in at %s" % (
|
||||
user.display_name,
|
||||
edbob.local_time().strftime('%I:%M %p')))
|
||||
request.session.flash("{0} logged in at {1}".format(
|
||||
user, localtime(request.rattail_config).strftime('%I:%M %p')))
|
||||
headers = remember(request, user.uuid)
|
||||
return HTTPFound(location=referrer, headers=headers)
|
||||
request.session.flash("Invalid username or password")
|
||||
|
||||
url = request.rattail_config.get('edbob.pyramid', 'login.logo_url',
|
||||
default=request.static_url('edbob.pyramid:static/img/logo.jpg'))
|
||||
kwargs = eval(request.rattail_config.get('edbob.pyramid', 'login.logo_kwargs',
|
||||
default="dict(width=500)"))
|
||||
|
||||
return {'form': FormRenderer(form), 'referrer': referrer,
|
||||
'logo_url': url, 'logo_kwargs': kwargs}
|
||||
return {'form': FormRenderer(form), 'referrer': referrer}
|
||||
|
||||
|
||||
def logout(request):
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2012 Lance Edgar
|
||||
# Copyright © 2010-2014 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -21,18 +20,18 @@
|
|||
# along with Rattail. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
"""
|
||||
Core Batch Views
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from pyramid.httpexceptions import HTTPFound
|
||||
from pyramid.renderers import render_to_response
|
||||
|
||||
from webhelpers.html import tags
|
||||
|
||||
from edbob.pyramid.forms import PrettyDateTimeFieldRenderer
|
||||
from ...forms import EnumFieldRenderer
|
||||
from tailbone.forms import DateTimeFieldRenderer, EnumFieldRenderer
|
||||
from ...grids.search import BooleanSearchFilter
|
||||
from .. import SearchableAlchemyGridView, CrudView, View
|
||||
from ...progress import SessionProgress
|
||||
|
@ -86,7 +85,6 @@ class BatchesGrid(SearchableAlchemyGridView):
|
|||
|
||||
def grid(self):
|
||||
g = self.make_grid()
|
||||
g.executed.set(renderer=PrettyDateTimeFieldRenderer(from_='utc'))
|
||||
g.configure(
|
||||
include=[
|
||||
g.source,
|
||||
|
@ -94,7 +92,7 @@ class BatchesGrid(SearchableAlchemyGridView):
|
|||
g.destination,
|
||||
g.description,
|
||||
g.rowcount.label("Row Count"),
|
||||
g.executed,
|
||||
g.executed.with_renderer(DateTimeFieldRenderer(self.request.rattail_config)),
|
||||
],
|
||||
readonly=True)
|
||||
if self.request.has_perm('batches.read'):
|
||||
|
@ -121,7 +119,6 @@ class BatchCrud(CrudView):
|
|||
def fieldset(self, model):
|
||||
fs = self.make_fieldset(model)
|
||||
fs.action_type.set(renderer=EnumFieldRenderer(enum.BATCH_ACTION))
|
||||
fs.executed.set(renderer=PrettyDateTimeFieldRenderer(from_='utc'))
|
||||
fs.configure(
|
||||
include=[
|
||||
fs.source,
|
||||
|
@ -130,7 +127,7 @@ class BatchCrud(CrudView):
|
|||
fs.action_type,
|
||||
fs.description,
|
||||
fs.rowcount.label("Row Count").readonly(),
|
||||
fs.executed.readonly(),
|
||||
fs.executed.with_renderer(DateTimeFieldRenderer(self.request.rattail_config)).readonly(),
|
||||
])
|
||||
return fs
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ from ..forms import AlchemyForm
|
|||
from formalchemy import FieldSet
|
||||
from ..db import Session
|
||||
|
||||
from edbob.util import requires_impl, prettify
|
||||
from edbob.util import prettify
|
||||
|
||||
|
||||
__all__ = ['CrudView']
|
||||
|
@ -46,18 +46,16 @@ class CrudView(View):
|
|||
update_cancel_route = None
|
||||
|
||||
@property
|
||||
@requires_impl(is_property=True)
|
||||
def mapped_class(self):
|
||||
pass
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def pretty_name(self):
|
||||
return self.mapped_class.__name__
|
||||
|
||||
@property
|
||||
@requires_impl(is_property=True)
|
||||
def home_route(self):
|
||||
pass
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def home_url(self):
|
||||
|
|
|
@ -37,7 +37,6 @@ from webhelpers.html.tags import link_to
|
|||
from pyramid.httpexceptions import HTTPFound
|
||||
from pyramid.renderers import render_to_response
|
||||
|
||||
import edbob
|
||||
from . import SearchableAlchemyGridView
|
||||
|
||||
import rattail.labels
|
||||
|
|
|
@ -35,12 +35,11 @@ from pyramid.response import Response
|
|||
|
||||
from ..db import Session
|
||||
|
||||
from edbob.time import local_time
|
||||
|
||||
import rattail
|
||||
from rattail import enum
|
||||
from rattail.db import model
|
||||
from rattail.files import resource_path
|
||||
from rattail.time import localtime
|
||||
|
||||
|
||||
plu_upc_pattern = re.compile(r'^000000000(\d{5})$')
|
||||
|
@ -112,7 +111,7 @@ class OrderingWorksheet(View):
|
|||
key = '{0} {1}'.format(brand, product.description)
|
||||
return key
|
||||
|
||||
now = local_time()
|
||||
now = localtime(self.request.rattail_config)
|
||||
data = dict(
|
||||
vendor=vendor,
|
||||
costs=costs,
|
||||
|
@ -174,7 +173,7 @@ class InventoryWorksheet(View):
|
|||
q = q.order_by(model.Brand.name, model.Product.description)
|
||||
return q.all()
|
||||
|
||||
now = local_time()
|
||||
now = localtime(self.request.rattail_config)
|
||||
data = dict(
|
||||
date=now.strftime('%a %d %b %Y'),
|
||||
time=now.strftime('%I:%M %p'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue