|
Lines 27-35
import subprocess
Link Here
|
| 27 |
import shlex |
27 |
import shlex |
| 28 |
import StringIO |
28 |
import StringIO |
| 29 |
import re |
29 |
import re |
| 30 |
import memcache |
|
|
| 31 |
import logging |
30 |
import logging |
| 32 |
|
31 |
|
|
|
32 |
try: |
| 33 |
import memcache |
| 34 |
use_memcache = True |
| 35 |
except ImportError: |
| 36 |
use_memcache = False |
| 37 |
|
| 33 |
from ConfigParser import NoOptionError, NoSectionError |
38 |
from ConfigParser import NoOptionError, NoSectionError |
| 34 |
from ipaddr import IPAddress, IPNetwork |
39 |
from ipaddr import IPAddress, IPNetwork |
| 35 |
from dateutil import parser |
40 |
from dateutil import parser |
|
Lines 849-855
class Memcache(object):
Link Here
|
| 849 |
return self.__current |
854 |
return self.__current |
| 850 |
|
855 |
|
| 851 |
def set_client(self): |
856 |
def set_client(self): |
| 852 |
if not self.__has_memcache: |
857 |
if not self.__has_memcache or use_memcache is False: |
| 853 |
return |
858 |
return |
| 854 |
|
859 |
|
| 855 |
if self.__is_trusted_network(): |
860 |
if self.__is_trusted_network(): |
|
Lines 870-876
class Memcache(object):
Link Here
|
| 870 |
self.__mc.set(self.__client, self.__current, time=ttl) |
875 |
self.__mc.set(self.__client, self.__current, time=ttl) |
| 871 |
|
876 |
|
| 872 |
def allow_client(self): |
877 |
def allow_client(self): |
| 873 |
if not self.__has_memcache: |
878 |
if not self.__has_memcache or use_memcache is False: |
| 874 |
return True |
879 |
return True |
| 875 |
|
880 |
|
| 876 |
self.__client = self.__environ["REMOTE_ADDR"] |
881 |
self.__client = self.__environ["REMOTE_ADDR"] |
|
Lines 914-917
class Memcache(object):
Link Here
|
| 914 |
|
919 |
|
| 915 |
return False |
920 |
return False |
| 916 |
|
921 |
|
| 917 |
# vim: expandtab ts=4 sw=4 |
922 |
# vim: expandtab ts=4 sw=4 |