remove ipv6 prefix from ipv4 addresses

This commit is contained in:
j 2012-05-19 13:46:06 +02:00
parent 45ff05ca49
commit bc494f6c18
2 changed files with 2 additions and 1 deletions

View file

@ -307,7 +307,6 @@ def resize_image(image_source, image_output, width=None, size=None):
def timeline( def timeline(
video, prefix, video, prefix,
modes=['antialias', 'slitscan', 'keyframes', 'audio', 'data'], modes=['antialias', 'slitscan', 'keyframes', 'audio', 'data'],
#modes=['antialias', 'slitscan', 'audio', 'data'],
size=[64, 16] size=[64, 16]
): ):
if isinstance(video, basestring): if isinstance(video, basestring):

View file

@ -96,6 +96,8 @@ class SessionData(models.Model):
if request.user.is_authenticated(): if request.user.is_authenticated():
data.user = request.user data.user = request.user
data.ip = request.META['REMOTE_ADDR'] data.ip = request.META['REMOTE_ADDR']
if data.ip.startswith('::ffff:'):
data.ip = data.ip[len('::ffff:'):]
data.useragent = request.META['HTTP_USER_AGENT'] data.useragent = request.META['HTTP_USER_AGENT']
data.info = json.loads(request.POST.get('data', '{}')) data.info = json.loads(request.POST.get('data', '{}'))
screen = data.info.get('screen', {}) screen = data.info.get('screen', {})