| 541 | |
| 542 | @staticmethod |
| 543 | def raw_value(_module, _preference, _category=None, _user_id=None): |
| 544 | # Find the entry for this module in the configuration database. |
| 545 | module = ModulePrefTable.query.filter_by(name=_module).first() |
| 546 | |
| 547 | if module is None: |
| 548 | return None |
| 549 | |
| 550 | if _category is None: |
| 551 | _category = _module |
| 552 | |
| 553 | if _user_id is None: |
| 554 | _user_id = getattr(current_user, 'id', None) |
| 555 | if _user_id is None: |
| 556 | return None |
| 557 | |
| 558 | cat = PrefCategoryTbl.query.filter_by( |
| 559 | mid=module.id).filter_by(name=_category).first() |
| 560 | |
| 561 | if cat is None: |
| 562 | return None |
| 563 | |
| 564 | pref = PrefTable.query.filter_by( |
| 565 | name=_preference).filter_by(cid=cat.id).first() |
| 566 | |
| 567 | if pref is None: |
| 568 | return None |
| 569 | |
| 570 | user_pref = UserPrefTable.query.filter_by( |
| 571 | pid=pref.id |
| 572 | ).filter_by(uid=_user_id).first() |
| 573 | |
| 574 | if user_pref is not None: |
| 575 | return user_pref.value |
| 576 | |
| 577 | return None |
| 578 | |
| 579 | @classmethod |
| 580 | def module(cls, name, create=True): |