Massive overhaul of "generate project" feature
previous incarnation was woefully lacking. new feature is much more extensible. still need to remove old POS integration specifics in some places. and a couple of unrelated things that snuck in.. - deprecate `rattail.util.OrderedDict` - deprecate `rattail.util.import_module_path()` - deprecate `rattail.util.import_reload()`
This commit is contained in:
parent
026d98551c
commit
2ed63b1c1a
22 changed files with 424 additions and 700 deletions
|
@ -32,6 +32,7 @@ import getpass
|
|||
import shutil
|
||||
import tempfile
|
||||
import logging
|
||||
from collections import OrderedDict
|
||||
|
||||
import json
|
||||
import sqlalchemy as sa
|
||||
|
@ -41,7 +42,7 @@ from sqlalchemy_utils.functions import get_primary_keys, get_columns
|
|||
|
||||
from rattail.db import model, Session as RattailSession
|
||||
from rattail.db.continuum import model_transaction_query
|
||||
from rattail.util import prettify, OrderedDict, simple_error
|
||||
from rattail.util import prettify, simple_error, get_class_hierarchy
|
||||
from rattail.time import localtime
|
||||
from rattail.threads import Thread
|
||||
from rattail.csvutil import UnicodeDictWriter
|
||||
|
@ -268,17 +269,7 @@ class MasterView(View):
|
|||
return labels
|
||||
|
||||
def get_class_hierarchy(self):
|
||||
hierarchy = []
|
||||
|
||||
def traverse(cls):
|
||||
if cls is not object:
|
||||
hierarchy.append(cls)
|
||||
for parent in cls.__bases__:
|
||||
traverse(parent)
|
||||
|
||||
traverse(self.__class__)
|
||||
hierarchy.reverse()
|
||||
return hierarchy
|
||||
return get_class_hierarchy(self.__class__)
|
||||
|
||||
def set_row_labels(self, obj):
|
||||
labels = self.collect_row_labels()
|
||||
|
@ -2215,8 +2206,9 @@ class MasterView(View):
|
|||
"""
|
||||
Returns the master view's index URL.
|
||||
"""
|
||||
route = self.get_route_prefix()
|
||||
return self.request.route_url(route, **kwargs)
|
||||
if self.listable:
|
||||
route = self.get_route_prefix()
|
||||
return self.request.route_url(route, **kwargs)
|
||||
|
||||
# TODO: this should not be class method, if possible
|
||||
# (pretty sure overriding as instance method works fine)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue