Browse Source

Remove mutable objects from function args

pull/2133/head
Ruud 12 years ago
parent
commit
779c7d2942
  1. 17
      couchpotato/core/downloaders/base.py
  2. 7
      couchpotato/core/downloaders/blackhole/main.py
  3. 4
      couchpotato/core/downloaders/nzbget/main.py
  4. 10
      couchpotato/core/downloaders/nzbvortex/main.py
  5. 4
      couchpotato/core/downloaders/pneumatic/main.py
  6. 4
      couchpotato/core/downloaders/sabnzbd/main.py
  7. 8
      couchpotato/core/downloaders/synology/main.py
  8. 8
      couchpotato/core/downloaders/utorrent/main.py
  9. 3
      couchpotato/core/media/_base/searcher/main.py
  10. 3
      couchpotato/core/media/movie/_base/main.py
  11. 4
      couchpotato/core/media/movie/library/movie/main.py
  12. 8
      couchpotato/core/notifications/base.py
  13. 3
      couchpotato/core/notifications/boxcar/main.py
  14. 6
      couchpotato/core/notifications/core/main.py
  15. 3
      couchpotato/core/notifications/email/main.py
  16. 3
      couchpotato/core/notifications/growl/main.py
  17. 3
      couchpotato/core/notifications/nmj/main.py
  18. 3
      couchpotato/core/notifications/notifo/main.py
  19. 3
      couchpotato/core/notifications/notifymyandroid/main.py
  20. 6
      couchpotato/core/notifications/plex/main.py
  21. 3
      couchpotato/core/notifications/prowl/main.py
  22. 3
      couchpotato/core/notifications/pushalot/main.py
  23. 3
      couchpotato/core/notifications/pushover/main.py
  24. 3
      couchpotato/core/notifications/synoindex/main.py
  25. 3
      couchpotato/core/notifications/toasty/main.py
  26. 3
      couchpotato/core/notifications/trakt/main.py
  27. 3
      couchpotato/core/notifications/twitter/main.py
  28. 3
      couchpotato/core/notifications/xbmc/main.py
  29. 7
      couchpotato/core/plugins/file/main.py
  30. 7
      couchpotato/core/plugins/manage/main.py
  31. 3
      couchpotato/core/plugins/quality/main.py
  32. 9
      couchpotato/core/plugins/renamer/main.py
  33. 1
      couchpotato/core/plugins/subtitle/main.py
  34. 5
      couchpotato/core/plugins/trailer/main.py
  35. 5
      couchpotato/core/providers/info/couchpotatoapi/main.py
  36. 19
      couchpotato/core/providers/metadata/base.py
  37. 4
      couchpotato/core/providers/metadata/xbmc/main.py
  38. 4
      couchpotato/core/settings/__init__.py
  39. 10
      couchpotato/core/settings/model.py

17
couchpotato/core/downloaders/base.py

@ -49,7 +49,10 @@ class Downloader(Provider):
return []
def _download(self, data = {}, movie = {}, manual = False, filedata = None):
def _download(self, data = None, movie = None, manual = False, filedata = None):
if not movie: movie = {}
if not data: data = {}
if self.isDisabled(manual, data):
return
return self.download(data = data, movie = movie, filedata = filedata)
@ -128,15 +131,21 @@ class Downloader(Provider):
'id': download_id
}
def isDisabled(self, manual = False, data = {}):
def isDisabled(self, manual = False, data = None):
if not data: data = {}
return not self.isEnabled(manual, data)
def _isEnabled(self, manual, data = {}):
def _isEnabled(self, manual, data = None):
if not data: data = {}
if not self.isEnabled(manual, data):
return
return True
def isEnabled(self, manual = False, data = {}):
def isEnabled(self, manual = False, data = None):
if not data: data = {}
d_manual = self.conf('manual', default = False)
return super(Downloader, self).isEnabled() and \
(d_manual and manual or d_manual is False) and \

7
couchpotato/core/downloaders/blackhole/main.py

@ -12,7 +12,9 @@ class Blackhole(Downloader):
protocol = ['nzb', 'torrent', 'torrent_magnet']
def download(self, data = {}, movie = {}, filedata = None):
def download(self, data = None, movie = None, filedata = None):
if not movie: movie = {}
if not data: data = {}
directory = self.conf('directory')
if not directory or not os.path.isdir(directory):
@ -62,7 +64,8 @@ class Blackhole(Downloader):
else:
return ['nzb']
def isEnabled(self, manual = False, data = {}):
def isEnabled(self, manual = False, data = None):
if not data: data = {}
for_protocol = ['both']
if data and 'torrent' in data.get('protocol'):
for_protocol.append('torrent')

4
couchpotato/core/downloaders/nzbget/main.py

@ -19,7 +19,9 @@ class NZBGet(Downloader):
url = 'http://%(username)s:%(password)s@%(host)s/xmlrpc'
def download(self, data = {}, movie = {}, filedata = None):
def download(self, data = None, movie = None, filedata = None):
if not movie: movie = {}
if not data: data = {}
if not filedata:
log.error('Unable to get NZB file: %s', traceback.format_exc())

10
couchpotato/core/downloaders/nzbvortex/main.py

@ -23,7 +23,9 @@ class NZBVortex(Downloader):
api_level = None
session_id = None
def download(self, data = {}, movie = {}, filedata = None):
def download(self, data = None, movie = None, filedata = None):
if not movie: movie = {}
if not data: data = {}
# Send the nzb
try:
@ -97,9 +99,10 @@ class NZBVortex(Downloader):
return False
def call(self, call, parameters = {}, repeat = False, auth = True, *args, **kwargs):
def call(self, call, parameters = None, repeat = False, auth = True, *args, **kwargs):
# Login first
if not parameters: parameters = {}
if not self.session_id and auth:
self.login()
@ -148,7 +151,8 @@ class NZBVortex(Downloader):
return self.api_level
def isEnabled(self, manual = False, data = {}):
def isEnabled(self, manual = False, data = None):
if not data: data = {}
return super(NZBVortex, self).isEnabled(manual, data) and self.getApiLevel()

4
couchpotato/core/downloaders/pneumatic/main.py

@ -12,7 +12,9 @@ class Pneumatic(Downloader):
protocol = ['nzb']
strm_syntax = 'plugin://plugin.program.pneumatic/?mode=strm&type=add_file&nzb=%s&nzbname=%s'
def download(self, data = {}, movie = {}, filedata = None):
def download(self, data = None, movie = None, filedata = None):
if not movie: movie = {}
if not data: data = {}
directory = self.conf('directory')
if not directory or not os.path.isdir(directory):

4
couchpotato/core/downloaders/sabnzbd/main.py

@ -15,7 +15,9 @@ class Sabnzbd(Downloader):
protocol = ['nzb']
def download(self, data = {}, movie = {}, filedata = None):
def download(self, data = None, movie = None, filedata = None):
if not movie: movie = {}
if not data: data = {}
log.info('Sending "%s" to SABnzbd.', data.get('name'))

8
couchpotato/core/downloaders/synology/main.py

@ -12,7 +12,9 @@ class Synology(Downloader):
protocol = ['nzb', 'torrent', 'torrent_magnet']
log = CPLog(__name__)
def download(self, data, movie, filedata = None):
def download(self, data = None, movie = None, filedata = None):
if not movie: movie = {}
if not data: data = {}
response = False
log.error('Sending "%s" (%s) to Synology.', (data['name'], data['protocol']))
@ -49,7 +51,9 @@ class Synology(Downloader):
else:
return ['nzb']
def isEnabled(self, manual = False, data = {}):
def isEnabled(self, manual = False, data = None):
if not data: data = {}
for_protocol = ['both']
if data and 'torrent' in data.get('protocol'):
for_protocol.append('torrent')

8
couchpotato/core/downloaders/utorrent/main.py

@ -36,7 +36,9 @@ class uTorrent(Downloader):
return self.utorrent_api
def download(self, data, movie, filedata = None):
def download(self, data = None, movie = None, filedata = None):
if not movie: movie = {}
if not data: data = {}
log.debug('Sending "%s" (%s) to uTorrent.', (data.get('name'), data.get('protocol')))
@ -280,7 +282,9 @@ class uTorrentAPI(object):
return settings_dict
def set_settings(self, settings_dict = {}):
def set_settings(self, settings_dict = None):
if not settings_dict: settings_dict = {}
for key in settings_dict:
if isinstance(settings_dict[key], bool):
settings_dict[key] = 1 if settings_dict[key] else 0

3
couchpotato/core/media/_base/searcher/main.py

@ -146,7 +146,8 @@ class Searcher(SearcherBase):
return search_protocols
def containsOtherQuality(self, nzb, movie_year = None, preferred_quality = {}):
def containsOtherQuality(self, nzb, movie_year = None, preferred_quality = None):
if not preferred_quality: preferred_quality = {}
name = nzb['name']
size = nzb.get('size', 0)

3
couchpotato/core/media/movie/_base/main.py

@ -346,7 +346,8 @@ class MovieBase(MovieTypeBase):
'movies': movies,
}
def add(self, params = {}, force_readd = True, search_after = True, update_library = False, status_id = None):
def add(self, params = None, force_readd = True, search_after = True, update_library = False, status_id = None):
if not params: params = {}
if not params.get('identifier'):
msg = 'Can\'t add movie without imdb identifier.'

4
couchpotato/core/media/movie/library/movie/main.py

@ -20,7 +20,9 @@ class MovieLibraryPlugin(LibraryBase):
addEvent('library.update.movie', self.update)
addEvent('library.update.movie.release_date', self.updateReleaseDate)
def add(self, attrs = {}, update_after = True):
def add(self, attrs = None, update_after = True):
if not attrs: attrs = {}
primary_provider = attrs.get('primary_provider', 'imdb')
db = get_session()

8
couchpotato/core/notifications/base.py

@ -32,7 +32,9 @@ class Notification(Provider):
addEvent(listener, self.createNotifyHandler(listener))
def createNotifyHandler(self, listener):
def notify(message = None, group = {}, data = None):
def notify(message = None, group = None, data = None):
if not group: group = {}
if not self.conf('on_snatch', default = True) and listener == 'movie.snatched':
return
return self._notify(message = message, data = data if data else group, listener = listener)
@ -47,8 +49,8 @@ class Notification(Provider):
return self.notify(*args, **kwargs)
return False
def notify(self, message = '', data = {}, listener = None):
pass
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
def test(self, **kwargs):

3
couchpotato/core/notifications/boxcar/main.py

@ -10,7 +10,8 @@ class Boxcar(Notification):
url = 'https://boxcar.io/devices/providers/7MNNXY3UIzVBwvzkKwkC/notifications'
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
try:
message = message.strip()

6
couchpotato/core/notifications/core/main.py

@ -128,7 +128,8 @@ class CoreNotifier(Notification):
Env.prop(prop_name, value = last_check)
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
db = get_session()
@ -149,7 +150,8 @@ class CoreNotifier(Notification):
return True
def frontend(self, type = 'notification', data = {}, message = None):
def frontend(self, type = 'notification', data = None, message = None):
if not data: data = {}
log.debug('Notifying frontend')

3
couchpotato/core/notifications/email/main.py

@ -11,7 +11,8 @@ log = CPLog(__name__)
class Email(Notification):
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
# Extract all the settings from settings
from_address = self.conf('from')

3
couchpotato/core/notifications/growl/main.py

@ -43,7 +43,8 @@ class Growl(Notification):
else:
log.error('Failed register of growl: %s', traceback.format_exc())
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
self.register()

3
couchpotato/core/notifications/nmj/main.py

@ -64,8 +64,9 @@ class NMJ(Notification):
'mount': mount,
}
def addToLibrary(self, message = None, group = {}):
def addToLibrary(self, message = None, group = None):
if self.isDisabled(): return
if not group: group = {}
host = self.conf('host')
mount = self.conf('mount')

3
couchpotato/core/notifications/notifo/main.py

@ -12,7 +12,8 @@ class Notifo(Notification):
url = 'https://api.notifo.com/v1/send_notification'
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
try:
params = {

3
couchpotato/core/notifications/notifymyandroid/main.py

@ -8,7 +8,8 @@ log = CPLog(__name__)
class NotifyMyAndroid(Notification):
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
nma = pynma.PyNMA()
keys = splitString(self.conf('api_key'))

6
couchpotato/core/notifications/plex/main.py

@ -17,8 +17,9 @@ class Plex(Notification):
super(Plex, self).__init__()
addEvent('renamer.after', self.addToLibrary)
def addToLibrary(self, message = None, group = {}):
def addToLibrary(self, message = None, group = None):
if self.isDisabled(): return
if not group: group = {}
log.info('Sending notification to Plex')
hosts = self.getHosts(port = 32400)
@ -45,7 +46,8 @@ class Plex(Notification):
return True
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
hosts = self.getHosts(port = 3000)
successful = 0

3
couchpotato/core/notifications/prowl/main.py

@ -12,7 +12,8 @@ class Prowl(Notification):
'api': 'https://api.prowlapp.com/publicapi/add'
}
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
data = {
'apikey': self.conf('api_key'),

3
couchpotato/core/notifications/pushalot/main.py

@ -11,7 +11,8 @@ class Pushalot(Notification):
'api': 'https://pushalot.com/api/sendmessage'
}
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
data = {
'AuthorizationToken': self.conf('auth_token'),

3
couchpotato/core/notifications/pushover/main.py

@ -11,7 +11,8 @@ class Pushover(Notification):
app_token = 'YkxHMYDZp285L265L3IwH3LmzkTaCy'
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
http_handler = HTTPSConnection("api.pushover.net:443")

3
couchpotato/core/notifications/synoindex/main.py

@ -15,8 +15,9 @@ class Synoindex(Notification):
super(Synoindex, self).__init__()
addEvent('renamer.after', self.addToLibrary)
def addToLibrary(self, message = None, group = {}):
def addToLibrary(self, message = None, group = None):
if self.isDisabled(): return
if not group: group = {}
command = [self.index_path, '-A', group.get('destination_dir')]
log.info('Executing synoindex command: %s ', command)

3
couchpotato/core/notifications/toasty/main.py

@ -11,7 +11,8 @@ class Toasty(Notification):
'api': 'http://api.supertoasty.com/notify/%s?%s'
}
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
data = {
'title': self.default_title,

3
couchpotato/core/notifications/trakt/main.py

@ -13,7 +13,8 @@ class Trakt(Notification):
listen_to = ['movie.downloaded']
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
post_data = {
'username': self.conf('automation_username'),

3
couchpotato/core/notifications/twitter/main.py

@ -30,7 +30,8 @@ class Twitter(Notification):
addApiView('notify.%s.auth_url' % self.getName().lower(), self.getAuthorizationUrl)
addApiView('notify.%s.credentials' % self.getName().lower(), self.getCredentials)
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
api = Api(self.consumer_key, self.consumer_secret, self.conf('access_token_key'), self.conf('access_token_secret'))

3
couchpotato/core/notifications/xbmc/main.py

@ -17,7 +17,8 @@ class XBMC(Notification):
use_json_notifications = {}
http_time_between_calls = 0
def notify(self, message = '', data = {}, listener = None):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
hosts = splitString(self.conf('host'))

7
couchpotato/core/plugins/file/main.py

@ -83,7 +83,8 @@ class FileManager(Plugin):
Env.get('app').add_handlers(".*$", [('%s%s' % (Env.get('api_base'), route), StaticFileHandler, {'path': Env.get('cache_dir')})])
def download(self, url = '', dest = None, overwrite = False, urlopen_kwargs = {}):
def download(self, url = '', dest = None, overwrite = False, urlopen_kwargs = None):
if not urlopen_kwargs: urlopen_kwargs = {}
if not dest: # to Cache
dest = os.path.join(Env.get('cache_dir'), '%s.%s' % (md5(url), getExt(url)))
@ -100,7 +101,9 @@ class FileManager(Plugin):
self.createFile(dest, filedata, binary = True)
return dest
def add(self, path = '', part = 1, type_tuple = (), available = 1, properties = {}):
def add(self, path = '', part = 1, type_tuple = (), available = 1, properties = None):
if not properties: properties = {}
type_id = self.getType(type_tuple).get('id')
db = get_session()

7
couchpotato/core/plugins/manage/main.py

@ -26,7 +26,8 @@ class Manage(Plugin):
addEvent('manage.diskspace', self.getDiskSpace)
# Add files after renaming
def after_rename(message = None, group = {}):
def after_rename(message = None, group = None):
if not group: group = {}
return self.scanFilesToLibrary(folder = group['destination_dir'], files = group['renamed_files'])
addEvent('renamer.after', after_rename, priority = 110)
@ -168,7 +169,9 @@ class Manage(Plugin):
fireEvent('notify.frontend', type = 'manage.updating', data = False)
self.in_progress = False
def createAddToLibrary(self, folder, added_identifiers = []):
def createAddToLibrary(self, folder, added_identifiers = None):
if not added_identifiers: added_identifiers = []
def addToLibrary(group, total_found, to_go):
if self.in_progress[folder]['total'] is None:
self.in_progress[folder] = {

3
couchpotato/core/plugins/quality/main.py

@ -152,7 +152,8 @@ class QualityPlugin(Plugin):
return True
def guess(self, files, extra = {}):
def guess(self, files, extra = None):
if not extra: extra = {}
# Create hash for cache
hash = md5(str([f.replace('.' + getExt(f), '') for f in files]))

9
couchpotato/core/plugins/renamer/main.py

@ -495,7 +495,9 @@ class Renamer(Plugin):
self.renaming_started = False
def getRenameExtras(self, extra_type = '', replacements = {}, folder_name = '', file_name = '', destination = '', group = {}, current_file = '', remove_multiple = False):
def getRenameExtras(self, extra_type = '', replacements = None, folder_name = '', file_name = '', destination = '', group = None, current_file = '', remove_multiple = False):
if not group: group = {}
if not replacements: replacements = {}
replacements = replacements.copy()
rename_files = {}
@ -847,7 +849,8 @@ Remove it if you want it to be renamed (again, or at least let it try again)
def movieInFromFolder(self, movie_folder):
return movie_folder and self.conf('from') in movie_folder or not movie_folder
def extractFiles(self, folder = None, movie_folder = None, files = [], cleanup = False):
def extractFiles(self, folder = None, movie_folder = None, files = None, cleanup = False):
if not files: files = []
# RegEx for finding rar files
archive_regex = '(?P<file>^(?P<base>(?:(?!\.part\d+\.rar$).)*)\.(?:(?:part0*1\.)?rar)$)'
@ -941,7 +944,7 @@ Remove it if you want it to be renamed (again, or at least let it try again)
self.makeDir(os.path.dirname(move_to))
self.moveFile(leftoverfile, move_to, cleanup)
except Exception, e:
log.error('Failed moving left over file %s to %s: %s %s',(leftoverfile, move_to, e, traceback.format_exc()))
log.error('Failed moving left over file %s to %s: %s %s', (leftoverfile, move_to, e, traceback.format_exc()))
# As we probably tried to overwrite the nfo file, check if it exists and then remove the original
if os.path.isfile(move_to):
if cleanup:

1
couchpotato/core/plugins/subtitle/main.py

@ -42,7 +42,6 @@ class Subtitle(Plugin):
subliminal.list_subtitles(files, cache_dir = Env.get('cache_dir'), multi = True, languages = self.getLanguages(), services = self.services)
def searchSingle(self, group):
if self.isDisabled(): return
try:

5
couchpotato/core/plugins/trailer/main.py

@ -12,8 +12,8 @@ class Trailer(Plugin):
def __init__(self):
addEvent('renamer.after', self.searchSingle)
def searchSingle(self, message = None, group = {}):
def searchSingle(self, message = None, group = None):
if not group: group = {}
if self.isDisabled() or len(group['files']['trailer']) > 0: return
trailers = fireEvent('trailer.search', group = group, merge = True)
@ -40,4 +40,3 @@ class Trailer(Plugin):
break
return True

5
couchpotato/core/providers/info/couchpotatoapi/main.py

@ -80,7 +80,10 @@ class CouchPotatoApi(MovieProvider):
return dates
def getSuggestions(self, movies = [], ignore = []):
def getSuggestions(self, movies = None, ignore = None):
if not ignore: ignore = []
if not movies: movies = []
suggestions = self.getJsonData(self.urls['suggest'], params = {
'movies': ','.join(movies),
'ignore': ','.join(ignore),

19
couchpotato/core/providers/metadata/base.py

@ -17,8 +17,9 @@ class MetaDataBase(Plugin):
def __init__(self):
addEvent('renamer.after', self.create)
def create(self, message = None, group = {}):
def create(self, message = None, group = None):
if self.isDisabled(): return
if not group: group = {}
log.info('Creating %s metadata.', self.getName())
@ -65,7 +66,8 @@ class MetaDataBase(Plugin):
except:
log.error('Unable to create %s file: %s', (file_type, traceback.format_exc()))
def getRootName(self, data = {}):
def getRootName(self, data = None):
if not data: data = {}
return os.path.join(data['destination_dir'], data['filename'])
def getFanartName(self, name, root):
@ -77,10 +79,13 @@ class MetaDataBase(Plugin):
def getNfoName(self, name, root):
return
def getNfo(self, movie_info = {}, data = {}):
return
def getNfo(self, movie_info = None, data = None):
if not data: data = {}
if not movie_info: movie_info = {}
def getThumbnail(self, movie_info = {}, data = {}, wanted_file_type = 'poster_original'):
def getThumbnail(self, movie_info = None, data = None, wanted_file_type = 'poster_original'):
if not data: data = {}
if not movie_info: movie_info = {}
file_types = fireEvent('file.types', single = True)
file_type = {}
@ -102,5 +107,7 @@ class MetaDataBase(Plugin):
except:
pass
def getFanart(self, movie_info = {}, data = {}):
def getFanart(self, movie_info = None, data = None):
if not data: data = {}
if not movie_info: movie_info = {}
return self.getThumbnail(movie_info = movie_info, data = data, wanted_file_type = 'backdrop_original')

4
couchpotato/core/providers/metadata/xbmc/main.py

@ -24,7 +24,9 @@ class XBMC(MetaDataBase):
def createMetaName(self, basename, name, root):
return os.path.join(root, basename.replace('%s', name))
def getNfo(self, movie_info = {}, data = {}):
def getNfo(self, movie_info = None, data = None):
if not data: data = {}
if not movie_info: movie_info = {}
# return imdb url only
if self.conf('meta_url_only'):

4
couchpotato/core/settings/__init__.py

@ -72,7 +72,9 @@ class Settings(object):
addEvent('settings.register', self.registerDefaults)
addEvent('settings.save', self.save)
def registerDefaults(self, section_name, options = {}, save = True):
def registerDefaults(self, section_name, options = None, save = True):
if not options: options = {}
self.addSection(section_name)
for option_name, option in options.iteritems():

10
couchpotato/core/settings/model.py

@ -137,7 +137,10 @@ class Release(Entity):
files = ManyToMany('File')
info = OneToMany('ReleaseInfo', cascade = 'all, delete-orphan')
def to_dict(self, deep = {}, exclude = []):
def to_dict(self, deep = None, exclude = None):
if not exclude: exclude = []
if not deep: deep = {}
orig_dict = super(Release, self).to_dict(deep = deep, exclude = exclude)
new_info = {}
@ -200,7 +203,10 @@ class Profile(Entity):
movie = OneToMany('Movie')
types = OneToMany('ProfileType', cascade = 'all, delete-orphan')
def to_dict(self, deep = {}, exclude = []):
def to_dict(self, deep = None, exclude = None):
if not exclude: exclude = []
if not deep: deep = {}
orig_dict = super(Profile, self).to_dict(deep = deep, exclude = exclude)
orig_dict['core'] = orig_dict.get('core') or False
orig_dict['hide'] = orig_dict.get('hide') or False

Loading…
Cancel
Save