From 68650a54886bd6905990bef7ee9d8500dcb1be38 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 19 Jul 2013 15:57:53 -0700 Subject: [PATCH] Removed several references to `edbob`. --- rattail/pyramid/grids/util.py | 2 +- rattail/pyramid/views/__init__.py | 11 ++---- rattail/pyramid/views/autocomplete.py | 4 +-- rattail/pyramid/views/batches/core.py | 13 +++---- .../pyramid/views/batches/params/__init__.py | 2 +- .../pyramid/views/batches/params/labels.py | 2 +- rattail/pyramid/views/batches/rows.py | 4 +-- rattail/pyramid/views/brands.py | 2 +- rattail/pyramid/views/categories.py | 2 +- rattail/pyramid/views/core.py | 35 +++++++++++++++++++ rattail/pyramid/views/crud.py | 4 +-- rattail/pyramid/views/customergroups.py | 3 +- rattail/pyramid/views/customers.py | 9 ++--- rattail/pyramid/views/departments.py | 4 +-- rattail/pyramid/views/employees.py | 4 +-- rattail/pyramid/views/labels.py | 6 ++-- rattail/pyramid/views/people.py | 4 +-- rattail/pyramid/views/products.py | 5 +-- rattail/pyramid/views/reports.py | 33 ++++++++++++++--- rattail/pyramid/views/stores.py | 4 +-- rattail/pyramid/views/subdepartments.py | 2 +- rattail/pyramid/views/vendors.py | 7 ++-- 22 files changed, 105 insertions(+), 57 deletions(-) create mode 100644 rattail/pyramid/views/core.py diff --git a/rattail/pyramid/grids/util.py b/rattail/pyramid/grids/util.py index 8970fdc5..df741c19 100644 --- a/rattail/pyramid/grids/util.py +++ b/rattail/pyramid/grids/util.py @@ -93,7 +93,7 @@ def get_sort_map(cls, names=None, **kwargs): def render_grid(grid, search_form=None, **kwargs): """ Convenience function to render ``grid`` (which should be a - :class:`edbob.pyramid.grids.Grid` instance). + :class:`rattail.pyramid.grids.Grid` instance). This "usually" will return a dictionary to be used as context for rendering the final view template. diff --git a/rattail/pyramid/views/__init__.py b/rattail/pyramid/views/__init__.py index 2cfdfc5b..4503353c 100644 --- a/rattail/pyramid/views/__init__.py +++ b/rattail/pyramid/views/__init__.py @@ -26,19 +26,12 @@ ``rattail.pyramid.views`` -- Pyramid Views """ +from rattail.pyramid.views.core import * +from rattail.pyramid.views.grids import * from rattail.pyramid.views.crud import * from rattail.pyramid.views.autocomplete import * -class View(object): - """ - Base for all class-based views. - """ - - def __init__(self, request): - self.request = request - - def includeme(config): config.include('rattail.pyramid.views.batches') # config.include('rattail.pyramid.views.categories') diff --git a/rattail/pyramid/views/autocomplete.py b/rattail/pyramid/views/autocomplete.py index 372320b5..bcfd9217 100644 --- a/rattail/pyramid/views/autocomplete.py +++ b/rattail/pyramid/views/autocomplete.py @@ -26,8 +26,8 @@ ``rattail.pyramid.views.autocomplete`` -- Autocomplete View """ -from edbob.pyramid.views import View -from edbob.pyramid import Session +from rattail.pyramid.views import View +from rattail.pyramid import Session __all__ = ['AutocompleteView'] diff --git a/rattail/pyramid/views/batches/core.py b/rattail/pyramid/views/batches/core.py index b1eefb5e..5a9a2cc8 100644 --- a/rattail/pyramid/views/batches/core.py +++ b/rattail/pyramid/views/batches/core.py @@ -31,15 +31,15 @@ from pyramid.renderers import render_to_response from webhelpers.html import tags -import edbob -from edbob.pyramid import Session -from edbob.pyramid.forms import EnumFieldRenderer, PrettyDateTimeFieldRenderer -from edbob.pyramid.grids.search import BooleanSearchFilter +from edbob.pyramid.forms import PrettyDateTimeFieldRenderer +from rattail.pyramid.forms import EnumFieldRenderer +from rattail.pyramid.grids.search import BooleanSearchFilter from edbob.pyramid.progress import SessionProgress -from edbob.pyramid.views import SearchableAlchemyGridView, CrudView, View +from rattail.pyramid.views import SearchableAlchemyGridView, CrudView, View import rattail from rattail import batches +from rattail.pyramid import Session from rattail.db.model import Batch from rattail.threads import Thread @@ -140,7 +140,8 @@ class BatchCrud(CrudView): class ExecuteBatch(View): def execute_batch(self, batch, progress): - session = edbob.Session() + from rattail.db import Session + session = Session() batch = session.merge(batch) if not batch.execute(progress): diff --git a/rattail/pyramid/views/batches/params/__init__.py b/rattail/pyramid/views/batches/params/__init__.py index 213a853e..af145b8f 100644 --- a/rattail/pyramid/views/batches/params/__init__.py +++ b/rattail/pyramid/views/batches/params/__init__.py @@ -26,7 +26,7 @@ ``rattail.pyramid.views.batches.params`` -- Batch Parameter Views """ -from edbob.pyramid.views import View +from rattail.pyramid.views import View __all__ = ['BatchParamsView'] diff --git a/rattail/pyramid/views/batches/params/labels.py b/rattail/pyramid/views/batches/params/labels.py index 73a16d3b..95b956d7 100644 --- a/rattail/pyramid/views/batches/params/labels.py +++ b/rattail/pyramid/views/batches/params/labels.py @@ -26,7 +26,7 @@ ``rattail.pyramid.views.batches.params.printlabels`` -- Print Labels Batch """ -from edbob.pyramid import Session +from rattail.pyramid import Session import rattail from rattail.pyramid.views.batches.params import BatchParamsView diff --git a/rattail/pyramid/views/batches/rows.py b/rattail/pyramid/views/batches/rows.py index 87840e0f..918f61d1 100644 --- a/rattail/pyramid/views/batches/rows.py +++ b/rattail/pyramid/views/batches/rows.py @@ -28,8 +28,8 @@ from pyramid.httpexceptions import HTTPFound -from edbob.pyramid import Session -from edbob.pyramid.views import SearchableAlchemyGridView, CrudView +from rattail.pyramid import Session +from rattail.pyramid.views import SearchableAlchemyGridView, CrudView import rattail from rattail.pyramid.forms import GPCFieldRenderer diff --git a/rattail/pyramid/views/brands.py b/rattail/pyramid/views/brands.py index a3d9aec2..a3b67fca 100644 --- a/rattail/pyramid/views/brands.py +++ b/rattail/pyramid/views/brands.py @@ -26,7 +26,7 @@ ``rattail.pyramid.views.brands`` -- Brand Views """ -from edbob.pyramid.views import ( +from rattail.pyramid.views import ( SearchableAlchemyGridView, CrudView, AutocompleteView) from rattail.db.model import Brand diff --git a/rattail/pyramid/views/categories.py b/rattail/pyramid/views/categories.py index d2927f4a..2133d5f0 100644 --- a/rattail/pyramid/views/categories.py +++ b/rattail/pyramid/views/categories.py @@ -26,7 +26,7 @@ ``rattail.pyramid.views.categories`` -- Category Views """ -from edbob.pyramid.views import SearchableAlchemyGridView, CrudView +from rattail.pyramid.views import SearchableAlchemyGridView, CrudView from rattail.db.model import Category diff --git a/rattail/pyramid/views/core.py b/rattail/pyramid/views/core.py new file mode 100644 index 00000000..36a244e4 --- /dev/null +++ b/rattail/pyramid/views/core.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +################################################################################ +# +# Rattail -- Retail Software Framework +# Copyright © 2010-2012 Lance Edgar +# +# This file is part of Rattail. +# +# Rattail is free software: you can redistribute it and/or modify it under the +# terms of the GNU Affero General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for +# more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Rattail. If not, see . +# +################################################################################ + +""" +``rattail.pyramid.views.core`` -- Core View +""" + +class View(object): + """ + Base for all class-based views. + """ + + def __init__(self, request): + self.request = request diff --git a/rattail/pyramid/views/crud.py b/rattail/pyramid/views/crud.py index ce0e0eb6..69f24940 100644 --- a/rattail/pyramid/views/crud.py +++ b/rattail/pyramid/views/crud.py @@ -30,9 +30,9 @@ from pyramid.httpexceptions import HTTPFound import formalchemy -from edbob.pyramid import Session +from rattail.pyramid import Session from edbob.pyramid.forms.formalchemy import AlchemyForm -from edbob.pyramid.views.core import View +from rattail.pyramid.views.core import View from edbob.util import requires_impl, prettify diff --git a/rattail/pyramid/views/customergroups.py b/rattail/pyramid/views/customergroups.py index fd7d5f79..46da8784 100644 --- a/rattail/pyramid/views/customergroups.py +++ b/rattail/pyramid/views/customergroups.py @@ -26,9 +26,8 @@ ``rattail.pyramid.views.customergroups`` -- CustomerGroup Views """ -from edbob.pyramid.views import SearchableAlchemyGridView +from rattail.pyramid.views import SearchableAlchemyGridView, CrudView -from rattail.pyramid.views import CrudView from rattail.pyramid import Session from rattail.db.model import CustomerGroup, CustomerGroupAssignment diff --git a/rattail/pyramid/views/customers.py b/rattail/pyramid/views/customers.py index 99206072..9a268d78 100644 --- a/rattail/pyramid/views/customers.py +++ b/rattail/pyramid/views/customers.py @@ -28,9 +28,10 @@ from sqlalchemy import and_ -import edbob -from edbob.pyramid.views import SearchableAlchemyGridView -from edbob.pyramid.forms import EnumFieldRenderer +from edbob.enum import EMAIL_PREFERENCE + +from rattail.pyramid.views import SearchableAlchemyGridView +from rattail.pyramid.forms import EnumFieldRenderer import rattail from rattail.pyramid import Session @@ -126,7 +127,7 @@ class CustomerCrud(CrudView): def fieldset(self, model): fs = self.make_fieldset(model) - fs.email_preference.set(renderer=EnumFieldRenderer(edbob.EMAIL_PREFERENCE)) + fs.email_preference.set(renderer=EnumFieldRenderer(EMAIL_PREFERENCE)) fs.configure( include=[ fs.id.label("ID"), diff --git a/rattail/pyramid/views/departments.py b/rattail/pyramid/views/departments.py index d53d1615..baca4a9b 100644 --- a/rattail/pyramid/views/departments.py +++ b/rattail/pyramid/views/departments.py @@ -27,9 +27,9 @@ """ -from edbob.pyramid.views import SearchableAlchemyGridView, CrudView, AlchemyGridView +from rattail.pyramid.views import ( + SearchableAlchemyGridView, CrudView, AlchemyGridView, AutocompleteView) -from rattail.pyramid.views import AutocompleteView from rattail.db.model import Department, Product, ProductCost, Vendor diff --git a/rattail/pyramid/views/employees.py b/rattail/pyramid/views/employees.py index a173ac4e..4bd35ba7 100644 --- a/rattail/pyramid/views/employees.py +++ b/rattail/pyramid/views/employees.py @@ -28,9 +28,7 @@ from sqlalchemy import and_ -from edbob.pyramid.views import SearchableAlchemyGridView - -from rattail.pyramid.views import CrudView +from rattail.pyramid.views import SearchableAlchemyGridView, CrudView from rattail.pyramid.grids.search import EnumSearchFilter from rattail.pyramid.forms import AssociationProxyField, EnumFieldRenderer from rattail.db.model import ( diff --git a/rattail/pyramid/views/labels.py b/rattail/pyramid/views/labels.py index aa26b0ea..b44327b8 100644 --- a/rattail/pyramid/views/labels.py +++ b/rattail/pyramid/views/labels.py @@ -32,9 +32,9 @@ import formalchemy from webhelpers.html import HTML -from edbob.pyramid import Session -from edbob.pyramid.views import SearchableAlchemyGridView, CrudView -from edbob.pyramid.grids.search import BooleanSearchFilter +from rattail.pyramid import Session +from rattail.pyramid.views import SearchableAlchemyGridView, CrudView +from rattail.pyramid.grids.search import BooleanSearchFilter from edbob.pyramid.forms import StrippingFieldRenderer from rattail.db.model import LabelProfile diff --git a/rattail/pyramid/views/people.py b/rattail/pyramid/views/people.py index 1d29e421..f183cd73 100644 --- a/rattail/pyramid/views/people.py +++ b/rattail/pyramid/views/people.py @@ -28,9 +28,9 @@ from sqlalchemy import and_ -from edbob.pyramid.views import SearchableAlchemyGridView +from rattail.pyramid.views import ( + SearchableAlchemyGridView, CrudView, AutocompleteView) -from rattail.pyramid.views import CrudView, AutocompleteView from rattail.pyramid import Session from rattail.db.model import (Person, PersonEmailAddress, PersonPhoneNumber, VendorContact) diff --git a/rattail/pyramid/views/products.py b/rattail/pyramid/views/products.py index 34af8a8c..67998574 100644 --- a/rattail/pyramid/views/products.py +++ b/rattail/pyramid/views/products.py @@ -36,7 +36,7 @@ from pyramid.renderers import render_to_response import edbob from edbob.pyramid.progress import SessionProgress -from edbob.pyramid.views import SearchableAlchemyGridView +from rattail.pyramid.views import SearchableAlchemyGridView import rattail.labels from rattail import sil @@ -268,7 +268,8 @@ def print_labels(request): class CreateProductsBatch(ProductsGrid): def make_batch(self, provider, progress): - session = edbob.Session() + from rattail.db import Session + session = Session() self._filter_config = self.filter_config() self._sort_config = self.sort_config() diff --git a/rattail/pyramid/views/reports.py b/rattail/pyramid/views/reports.py index e739d71c..327eef52 100644 --- a/rattail/pyramid/views/reports.py +++ b/rattail/pyramid/views/reports.py @@ -1,7 +1,29 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- +################################################################################ +# +# Rattail -- Retail Software Framework +# Copyright © 2010-2012 Lance Edgar +# +# This file is part of Rattail. +# +# Rattail is free software: you can redistribute it and/or modify it under the +# terms of the GNU Affero General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for +# more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Rattail. If not, see . +# +################################################################################ """ -``dtail.views.reports`` -- Report Views +``rattail.pyramid.views.reports`` -- Report Views """ import os @@ -13,10 +35,11 @@ from mako.template import Template from pyramid.response import Response import edbob -from edbob.pyramid import Session -from edbob.files import resource_path +from edbob.time import local_time import rattail +from rattail.pyramid import Session +from rattail.files import resource_path plu_upc_pattern = re.compile(r'^000000000(\d{5})$') @@ -69,7 +92,7 @@ def write_inventory_worksheet(request, department): q = q.order_by(rattail.Brand.name, rattail.Product.description) return q.all() - now = edbob.local_time() + now = local_time() data = dict( date=now.strftime('%a %d %b %Y'), time=now.strftime('%I:%M %p'), @@ -134,7 +157,7 @@ def write_ordering_worksheet(vendor, departments, preferred_only): key = '{0} {1}'.format(brand, product.description) return key - now = edbob.local_time() + now = local_time() data = dict( vendor=vendor, costs=costs, diff --git a/rattail/pyramid/views/stores.py b/rattail/pyramid/views/stores.py index 6f050f72..93662ffc 100644 --- a/rattail/pyramid/views/stores.py +++ b/rattail/pyramid/views/stores.py @@ -28,9 +28,7 @@ from sqlalchemy import and_ -from edbob.pyramid.views import SearchableAlchemyGridView - -from rattail.pyramid.views import CrudView +from rattail.pyramid.views import SearchableAlchemyGridView, CrudView from rattail.db.model import Store, StoreEmailAddress, StorePhoneNumber diff --git a/rattail/pyramid/views/subdepartments.py b/rattail/pyramid/views/subdepartments.py index cf36453b..5d71d698 100644 --- a/rattail/pyramid/views/subdepartments.py +++ b/rattail/pyramid/views/subdepartments.py @@ -26,7 +26,7 @@ ``rattail.pyramid.views.subdepartments`` -- Subdepartment Views """ -from edbob.pyramid.views import SearchableAlchemyGridView, CrudView +from rattail.pyramid.views import SearchableAlchemyGridView, CrudView from rattail.db.model import Subdepartment diff --git a/rattail/pyramid/views/vendors.py b/rattail/pyramid/views/vendors.py index 2b8d7c96..17584f56 100644 --- a/rattail/pyramid/views/vendors.py +++ b/rattail/pyramid/views/vendors.py @@ -26,11 +26,10 @@ ``rattail.pyramid.views.vendors`` -- Vendor Views """ -from edbob.pyramid.views import SearchableAlchemyGridView - -from rattail.db.model import Vendor -from rattail.pyramid.views import CrudView, AutocompleteView +from rattail.pyramid.views import ( + SearchableAlchemyGridView, CrudView, AutocompleteView) from rattail.pyramid.forms import AssociationProxyField, PersonFieldRenderer +from rattail.db.model import Vendor class VendorsGrid(SearchableAlchemyGridView):