__load__.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. self.data['setting']['footer'] = self.service('common').list('web_article', search={'category_id':1})
  24. self.data['setting']['front'] = Demeter.config['front']['url']
  25. cur = 'main'
  26. if '/' in self.request.uri:
  27. temp = self.request.uri.split('?')
  28. temp = temp[0].split('/')
  29. slen = len(temp)
  30. if slen > 1 and temp[1]:
  31. cur = temp[1]
  32. self.data['setting']['cur'] = cur