__load__.py 798 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # -*- coding: utf-8 -*-
  2. """
  3. demeter load
  4. author:rabin
  5. """
  6. from demeter.web import *
  7. #可以在此定义一些核心类库
  8. # 这个是基类
  9. class Load(Base):
  10. # user是权限
  11. KEYS = ('user',)
  12. def setting(self):
  13. self.user()
  14. def user(self):
  15. ajax = self.input('ajax')
  16. if ajax:
  17. self.data['ajax'] = True
  18. else:
  19. self.data['ajax'] = False
  20. self.data['auth'] = True
  21. # 权限判断
  22. if 'user' in self.data['setting'] and self.data['setting']['user'] > 0:
  23. self.data['setting']['userInfo'] = self.service('common').one('farm_user', id=self.data['setting']['user'])
  24. else:
  25. # 没有权限
  26. return
  27. if '/' in self.request.uri:
  28. temp = self.request.uri.split('/')
  29. slen = len(temp)
  30. if slen > 1 and temp[1]:
  31. cur = temp[1]
  32. self.data['setting']['cur'] = cur