new_contents: # -*- coding: utf-8 -*-
  # Generated by Django 1.11.1 on 2017-05-30 19:21
  from __future__ import unicode_literals
  from urllib2 import quote, unquote
  
  from bulk_update.helper import bulk_update
  from django.db import migrations
  
  from addons.googledrive.models import NodeSettings
  
  
  def unquote_folder_paths(*args):
      targets = NodeSettings.objects.filter(folder_path__isnull=False)
      for obj in targets:
          try:
              obj.folder_path = unquote(obj.folder_path).decode('utf-8')
          except UnicodeEncodeError:
              obj.folder_path = unquote(obj.folder_path)
      bulk_update(targets, update_fields=['folder_path'])
  
  def quote_folder_paths(*args):
      targets = NodeSettings.objects.filter(folder_path__isnull=False)
      for obj in targets:
          obj.folder_path = quote(obj.folder_path.encode('utf-8'))
      bulk_update(targets, update_fields=['folder_path'])
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('osf', '0031_preprintprovider_share_source'),
      ]
  
      operations = [
          migrations.RunPython(unquote_folder_paths, quote_folder_paths),
      ]
  
subject: Add migration