refactored pickle everywhere but Session, removed unused imports
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
# fix response
|
||||
|
||||
import re
|
||||
import os
|
||||
import cPickle
|
||||
import gluon.serializers
|
||||
from gluon import current, HTTP
|
||||
from gluon.html import markmin_serializer, TAG, HTML, BODY, UL, XML, H1
|
||||
from gluon.contenttype import contenttype
|
||||
from gluon.contrib.fpdf import FPDF, HTMLMixin
|
||||
from gluon.sanitizer import sanitize
|
||||
from gluon.contrib.markmin.markmin2latex import markmin2latex
|
||||
|
||||
@@ -6,7 +6,10 @@ import redis
|
||||
from redis.exceptions import ConnectionError
|
||||
from gluon import current
|
||||
from gluon.cache import CacheAbstract
|
||||
import cPickle as pickle
|
||||
try:
|
||||
import cPickle as pickle
|
||||
except:
|
||||
import pickle
|
||||
import time
|
||||
import re
|
||||
import logging
|
||||
@@ -165,7 +168,7 @@ class RedisClient(object):
|
||||
expireat = int(time.time() + time_expire) + 120
|
||||
bucket_key = "%s:%s" % (cache_set_key, expireat / 60)
|
||||
value = f()
|
||||
value_ = pickle.dumps(value)
|
||||
value_ = pickle.dumps(value, pickle.HIGHEST_PROTOCOL)
|
||||
if time_expire == 0:
|
||||
time_expire = 1
|
||||
self.r_server.setex(key, value_, time_expire)
|
||||
|
||||
@@ -3,12 +3,9 @@ Developed by niphlod@gmail.com
|
||||
"""
|
||||
|
||||
import redis
|
||||
from redis.exceptions import ConnectionError
|
||||
from gluon import current
|
||||
from gluon.storage import Storage
|
||||
import cPickle as pickle
|
||||
import time
|
||||
import re
|
||||
import logging
|
||||
import thread
|
||||
|
||||
|
||||
Reference in New Issue
Block a user