本文整理汇总了Python中mediacore.model.DBSession.add_all方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.add_all方法的具体用法?Python DBSession.add_all怎么用?Python DBSession.add_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mediacore.model.DBSession
的用法示例。
在下文中一共展示了DBSession.add_all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from mediacore.model import DBSession [as 别名]
# 或者: from mediacore.model.DBSession import add_all [as 别名]
def save(self, email, legal_wording, default_wording, **kwargs):
"""Save :class:`~mediacore.forms.settings.SettingsForm`.
Redirects back to :meth:`edit` after successful editing.
"""
settings = self._fetch_keyed_settings()
settings['email_media_uploaded'].value = email['media_uploaded']
settings['email_comment_posted'].value = email['comment_posted']
settings['email_support_requests'].value = email['support_requests']
settings['email_send_from'].value = email['send_from']
# settings['ftp_server'].value = ftp['server']
# settings['ftp_username'].value = ftp['username']
# if ftp['password'] is not None and ftp['password'] != '':
# settings['ftp_password'].value = ftp['password']
# settings['ftp_upload_path'].value = ftp['upload_path']
# settings['ftp_download_url'].value = ftp['download_url']
settings['wording_user_uploads'].value = legal_wording['user_uploads']
settings['wording_additional_notes'].value = default_wording['additional_notes']
DBSession.add_all(settings.values())
DBSession.flush()
redirect(action='edit')