# Path: core/classes/model/base.py



from sqlalchemy                 import Column
from sqlalchemy                 import Integer
from sqlalchemy                 import Boolean
from sqlalchemy                 import ForeignKey
from core.classes.model.base    import MapifBase
from core.classes.model.session import session
from core.modules               import logger
        q = s.query(UserPreferences)
        q = UserPreferencesCRUD.__apply_filters(q, **kwargs)
        return (s, q)
    #---------------------------------------------------------------------------
    # update
    #---------------------------------------------------------------------------
    @staticmethod
    def update(uid, **kwargs):
        state = False
        s = session()
        pref = s.query(UserPreferences).filter(UserPreferences.uid == uid).one_or_none()
        if pref is not None:
            for key, val in kwargs.items():
                if val is not None and key in UserPreferencesCRUD.ATTRIBUTES:
                    if key == 'uid':
                        modlgr.warning('update() cannot update uid.')
                        continue
                    setattr(pref, key, val)
            s.add(pref)
            s.commit()
            state = True
        s.close()
        return state
    #---------------------------------------------------------------------------
    # delete 
    #---------------------------------------------------------------------------
    @staticmethod
    def delete(**kwargs):
        s = session()
        q = s.query(UserPreferences)

# Path: core/classes/model/base.py



# Path: core/classes/model/user_preferences.py
from sqlalchemy                 import Column
from sqlalchemy                 import Integer
from sqlalchemy                 import Boolean
from sqlalchemy                 import ForeignKey
from core.classes.model.base    import MapifBase
from core.classes.model.session import session
from core.modules               import logger

        q = s.query(UserPreferences)
        q = UserPreferencesCRUD.__apply_filters(q, **kwargs)
        return (s, q)
    #---------------------------------------------------------------------------
    # update
    #---------------------------------------------------------------------------
    @staticmethod
    def update(uid, **kwargs):
        state = False
        s = session()
        pref = s.query(UserPreferences).filter(UserPreferences.uid == uid).one_or_none()
        if pref is not None:
            for key, val in kwargs.items():
                if val is not None and key in UserPreferencesCRUD.ATTRIBUTES:
                    if key == 'uid':
                        modlgr.warning('update() cannot update uid.')
                        continue
                    setattr(pref, key, val)
            s.add(pref)
            s.commit()
            state = True
        s.close()
        return state
    #---------------------------------------------------------------------------
    # delete 
    #---------------------------------------------------------------------------
    @staticmethod
    def delete(**kwargs):
        s = session()
        q = s.query(UserPreferences)

        q = UserPreferencesCRUD.__apply_filters(q, **kwargs)