Пример #1
0
 def _remote_address_allowed(self):
     # check localhost first to avoid accessing the database for nothing
     remote_addr = request.remote_addr
     remote_port = request.environ['SERVER_PORT']
     if remote_addr == self.ALLOWED_HOST and remote_port == self._allowed_port:
         return True
     return remote_addr in accesswebservice_dao.get_allowed_hosts()
Пример #2
0
 def _remote_address_allowed(self):
     # check localhost first to avoid accessing the database for nothing
     remote_addr = request.access_route[0]
     if remote_addr in self.ALLOWED_HOSTS:
         return True
     return remote_addr in accesswebservice_dao.get_allowed_hosts()
 def test_get_allowed_hosts(self):
     self._insert_access_web_service(host='15.15.15.15')
     self._insert_access_web_service(host='11.11.11.11')
     hosts = set(accesswebservice_dao.get_allowed_hosts())
     self.assertEqual(hosts, set(['15.15.15.15', '11.11.11.11']))
Пример #4
0
 def test_get_allowed_hosts(self):
     self._insert_access_web_service('15.15.15.15')
     self._insert_access_web_service('11.11.11.11')
     hosts = set(accesswebservice_dao.get_allowed_hosts())
     self.assertEqual(hosts, set(['15.15.15.15', '11.11.11.11']))
Пример #5
0
 def _remote_address_allowed(self):
     # check localhost first to avoid accessing the database for nothing
     if request.remote_addr in self.ALLOWED_HOSTS:
         return True
     return request.remote_addr in accesswebservice_dao.get_allowed_hosts()