Commit f6e63085 authored by Hubert Denkmair's avatar Hubert Denkmair

auto-migrate old api users

parent 972bd776
import re
from core.models import UserProfile, SnakeVersion
for up in UserProfile.objects.all():
if up.active_snake is None:
continue
old_version = up.active_snake
code = old_version.code
comment = "automagically converted to use new standard pairs() api"
new_code = "-- " + comment
new_code += re.sub(r'(\w+)\:pairs\(\)', r'pairs(\1)', code)
new_version = SnakeVersion(
user=up.user,
code=new_code,
comment=comment,
parent=old_version
)
new_version.save()
up.active_snake = new_version
up.save()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment