From 1973614840f30b906b81e019e7f409695f6e37cf Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 13 Apr 2024 09:09:23 -0500 Subject: [PATCH] Rename people "view_profile" template (drop buefy suffix) --- ...w_profile_buefy.mako => view_profile.mako} | 0 tailbone/views/people.py | 34 +++++++------------ 2 files changed, 12 insertions(+), 22 deletions(-) rename tailbone/templates/people/{view_profile_buefy.mako => view_profile.mako} (100%) diff --git a/tailbone/templates/people/view_profile_buefy.mako b/tailbone/templates/people/view_profile.mako similarity index 100% rename from tailbone/templates/people/view_profile_buefy.mako rename to tailbone/templates/people/view_profile.mako diff --git a/tailbone/views/people.py b/tailbone/views/people.py index 071e58b5..7b175e25 100644 --- a/tailbone/views/people.py +++ b/tailbone/views/people.py @@ -34,12 +34,9 @@ import sqlalchemy_continuum as continuum from rattail.db import api from rattail.db.model import Person, PersonNote, MergePeopleRequest -from rattail.db.util import maxlen -from rattail.time import localtime from rattail.util import simple_error import colander -from pyramid.httpexceptions import HTTPFound, HTTPNotFound from webhelpers2.html import HTML, tags from tailbone import forms, grids @@ -221,7 +218,7 @@ class PersonView(MasterView): instance = self.Session.get(model.VendorContact, key) if instance: return instance.person - raise HTTPNotFound + raise self.notfound() def is_person_protected(self, person): for user in person.users: @@ -495,7 +492,7 @@ class PersonView(MasterView): if self.request.has_perm('people_profile.view_versions'): context['revisions_grid'] = self.profile_revisions_grid(person) - return self.render_to_response('view_profile_buefy', context) + return self.render_to_response('view_profile', context) def get_context_tabchecks(self, person): app = self.get_rattail_app() @@ -558,28 +555,21 @@ class PersonView(MasterView): """ return kwargs - def template_kwargs_view_profile_buefy(self, **kwargs): - """ - Note that any subclass should not need to define this method. - It by default invokes :meth:`template_kwargs_view_profile()` - and returns that result. - """ - return self.template_kwargs_view_profile(**kwargs) - def get_max_lengths(self): + app = self.get_rattail_app() model = self.model lengths = { - 'person_first_name': maxlen(model.Person.first_name), - 'person_middle_name': maxlen(model.Person.middle_name), - 'person_last_name': maxlen(model.Person.last_name), - 'address_street': maxlen(model.PersonMailingAddress.street), - 'address_street2': maxlen(model.PersonMailingAddress.street2), - 'address_city': maxlen(model.PersonMailingAddress.city), - 'address_state': maxlen(model.PersonMailingAddress.state), - 'address_zipcode': maxlen(model.PersonMailingAddress.zipcode), + 'person_first_name': app.maxlen(model.Person.first_name), + 'person_middle_name': app.maxlen(model.Person.middle_name), + 'person_last_name': app.maxlen(model.Person.last_name), + 'address_street': app.maxlen(model.PersonMailingAddress.street), + 'address_street2': app.maxlen(model.PersonMailingAddress.street2), + 'address_city': app.maxlen(model.PersonMailingAddress.city), + 'address_state': app.maxlen(model.PersonMailingAddress.state), + 'address_zipcode': app.maxlen(model.PersonMailingAddress.zipcode), } if self.people_handler.should_use_preferred_first_name(): - lengths['person_preferred_first_name'] = maxlen(model.Person.preferred_first_name) + lengths['person_preferred_first_name'] = app.maxlen(model.Person.preferred_first_name) return lengths def get_phone_type_options(self):