Changeset 862198c in tailbone


Ignore:
Timestamp:
08/03/2022 11:13:43 AM (6 months ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
4ff0450
Parents:
3726a26
Message:

Improve "touch" logic for employees

also use app handler for default touch logic

Location:
tailbone/views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tailbone/views/employees.py

    r3726a26 r862198c  
    305305        return HTML.tag('ul', c=items)
    306306
     307    def touch_instance(self, employee):
     308        app = self.get_rattail_app()
     309        employment = app.get_employment_handler()
     310        employment.touch_employee(self.Session(), employee)
     311
    307312    def get_version_child_classes(self):
    308313        return [
  • tailbone/views/master.py

    r3726a26 r862198c  
    11601160        Perform actual "touch" logic for the given object.
    11611161        """
    1162         change = model.Change()
    1163         change.class_name = obj.__class__.__name__
    1164         change.instance_uuid = obj.uuid
    1165         change = self.Session.merge(change)
    1166         change.deleted = False
     1162        app = self.get_rattail_app()
     1163        app.touch_object(self.Session(), obj)
    11671164
    11681165    def versions(self):
     
    47964793            config.add_tailbone_permission(permission_prefix, '{}.touch'.format(permission_prefix),
    47974794                                           "\"Touch\" a {} to trigger datasync for it".format(model_title))
    4798             config.add_route('{}.touch'.format(route_prefix), '{}/touch'.format(instance_url_prefix))
     4795            config.add_route('{}.touch'.format(route_prefix),
     4796                             '{}/touch'.format(instance_url_prefix),
     4797                             # TODO: should add this restriction after the old
     4798                             # jquery theme is no longer in use
     4799                             #request_method='POST'
     4800            )
    47994801            config.add_view(cls, attr='touch', route_name='{}.touch'.format(route_prefix),
    48004802                            permission='{}.touch'.format(permission_prefix))
Note: See TracChangeset for help on using the changeset viewer.