__load__.py 891 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. demeter load
  5. author:rabin
  6. """
  7. from demeter.web import *
  8. class Load(Base):
  9. KEYS = ('user', 'farm')
  10. def setting(self):
  11. self.info()
  12. def info(self):
  13. ajax = self.input('ajax')
  14. if ajax:
  15. self.data['ajax'] = True
  16. else:
  17. self.data['ajax'] = False
  18. self.data['auth'] = True
  19. if 'user' in self.data['setting'] and self.data['setting']['user'] > 0:
  20. self.data['setting']['userInfo'] = self.service('common').one('farm_user', id=self.data['setting']['user'])
  21. self.data['setting']['web'] = self.service('common').one('web_set', id=1)
  22. self.data['setting']['menu'] = self.service('common').list('web_menu')
  23. cur = 'main'
  24. if '/' in self.request.uri:
  25. temp = self.request.uri.split('?')
  26. temp = temp[0].split('/')
  27. slen = len(temp)
  28. if slen > 1 and temp[1]:
  29. cur = temp[1]
  30. self.data['setting']['cur'] = cur