addons-server/migrations/642-encrypt-secret.py

21 строка
444 B
Python
Исходник Обычный вид История

2013-08-15 00:03:32 +04:00
from datetime import datetime
2013-08-10 01:57:17 +04:00
import amo
from aesfield.field import AESField
class FrozenAPIAccess(amo.models.ModelBase):
secret = AESField(max_length=255, aes_key='api:access:secret')
class Meta:
db_table = 'api_access'
def run():
for access in FrozenAPIAccess.objects.all():
access.secret = str(access.secret)
2013-08-15 00:03:32 +04:00
if not access.created:
access.created = datetime.now()
2013-08-10 01:57:17 +04:00
access.save()