mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-16 13:08:03 +00:00
Remove dryrun, since saving the data to a string, will be problematic with ascii and sh*t
This commit is contained in:
@@ -101,7 +101,7 @@ def encode_photo(photo_filename, photo_format):
|
|||||||
return base64.b64encode(photo_content)
|
return base64.b64encode(photo_content)
|
||||||
|
|
||||||
|
|
||||||
def main(argv=None, dryrun=False):
|
def main(argv=None):
|
||||||
if argv is None:
|
if argv is None:
|
||||||
argv = sys.argv
|
argv = sys.argv
|
||||||
|
|
||||||
@@ -109,8 +109,6 @@ def main(argv=None, dryrun=False):
|
|||||||
userobjs = User.objects.filter(username=sys.argv[1])
|
userobjs = User.objects.filter(username=sys.argv[1])
|
||||||
else:
|
else:
|
||||||
userobjs = User.objects.all()
|
userobjs = User.objects.all()
|
||||||
if(len(sys.argv) > 2):
|
|
||||||
dryrun = True
|
|
||||||
|
|
||||||
for user in userobjs:
|
for user in userobjs:
|
||||||
hash_object = hashlib.new('sha256')
|
hash_object = hashlib.new('sha256')
|
||||||
@@ -123,21 +121,16 @@ def main(argv=None, dryrun=False):
|
|||||||
username = user.username
|
username = user.username
|
||||||
|
|
||||||
dest_filename = settings.EXPORT_FILES_ROOT + file_hash + '.xml.gz'
|
dest_filename = settings.EXPORT_FILES_ROOT + file_hash + '.xml.gz'
|
||||||
data = ''
|
|
||||||
data += xml_header()
|
|
||||||
data += xml_account(username)
|
|
||||||
data += xml_email(user.confirmed_emails.all())
|
|
||||||
data += xml_openid(user.confirmed_openids.all())
|
|
||||||
data += xml_photos(photos)
|
|
||||||
data += xml_footer()
|
|
||||||
|
|
||||||
if not dryrun:
|
destination = gzip.open(dest_filename, 'w')
|
||||||
destination = gzip.open(dest_filename, 'w')
|
destination.write(xml_header())
|
||||||
destination.write(data)
|
destination.write(xml_account(username))
|
||||||
destination.close()
|
destination.write(xml_email(user.confirmed_emails.all()))
|
||||||
print(dest_filename)
|
destination.write(xml_openid(user.confirmed_openids.all()))
|
||||||
else:
|
destination.write(xml_photos(photos))
|
||||||
print(data)
|
destination.write(xml_footer())
|
||||||
|
destination.close()
|
||||||
|
print(dest_filename)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user