Changeset - 237c2d355671
[Not reviewed]
0 1 0
Lance Edgar (lance) - 3 months ago 2024-07-16 21:13:02
lance@edbob.org
fix: fix bugs in `OrgHandler.get_subdepartment()`
1 file changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
rattail/org.py
Show inline comments
 
@@ -2,7 +2,7 @@
 
################################################################################
 
#
 
#  Rattail -- Retail Software Framework
 
#  Copyright © 2010-2023 Lance Edgar
 
#  Copyright © 2010-2024 Lance Edgar
 
#
 
#  This file is part of Rattail.
 
#
 
@@ -26,7 +26,7 @@ Org Handler
 

	
 
from sqlalchemy import orm
 

	
 
from rattail.app import GenericHandler
 
from wuttjamaican.app import GenericHandler
 

	
 

	
 
class OrgHandler(GenericHandler):
 
@@ -53,7 +53,7 @@ class OrgHandler(GenericHandler):
 
        :returns: The :class:`~rattail.db.model.Store` instance if
 
           found; otherwise ``None``.
 
        """
 
        model = self.model
 
        model = self.app.model
 

	
 
        # Store.uuid match?
 
        store = session.get(model.Store, key)
 
@@ -87,7 +87,7 @@ class OrgHandler(GenericHandler):
 
        :returns: The :class:`~rattail.db.model.Department` instance
 
           if found; otherwise ``None``.
 
        """
 
        model = self.model
 
        model = self.app.model
 

	
 
        # Department.uuid match?
 
        department = session.get(model.Department, str(key))
 
@@ -106,7 +106,7 @@ class OrgHandler(GenericHandler):
 
        if key is not None:
 
            return self.get_department(session, key)
 

	
 
    def get_subdepartment(session, key):
 
    def get_subdepartment(self, session, key):
 
        """
 
        Locate and return a subdepartment for the given key, if
 
        possible.
 
@@ -123,10 +123,10 @@ class OrgHandler(GenericHandler):
 
        :returns: The :class:`~rattail.db.model.Subdepartment`
 
           instance if found; otherwise ``None``.
 
        """
 
        model = self.model
 
        model = self.app.model
 

	
 
        # Subdepartment.uuid match?
 
        subdepartment = session.get(model.Subdepartment, key)
 
        subdepartment = session.get(model.Subdepartment, str(key))
 
        if subdepartment:
 
            return subdepartment
 

	
0 comments (0 inline, 0 general)