本文整理汇总了Python中mediadrop.model.User.user_name方法的典型用法代码示例。如果您正苦于以下问题:Python User.user_name方法的具体用法?Python User.user_name怎么用?Python User.user_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mediadrop.model.User
的用法示例。
在下文中一共展示了User.user_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_user_without_groups
# 需要导入模块: from mediadrop.model import User [as 别名]
# 或者: from mediadrop.model.User import user_name [as 别名]
def _create_user_without_groups(self):
user = User()
user.user_name = u"joe"
user.email_address = u"[email protected]"
user.display_name = u"Joe"
user.groups = []
DBSession.add(user)
DBSession.flush()
return user
示例2: permissions_for_user
# 需要导入模块: from mediadrop.model import User [as 别名]
# 或者: from mediadrop.model.User import user_name [as 别名]
def permissions_for_user(cls, user, config):
if user is None:
user = User()
user.display_name = u'Anonymous User'
user.user_name = u'anonymous'
user.email_address = '[email protected]'
anonymous_group = Group.by_name(u'anonymous')
groups = filter(None, [anonymous_group])
else:
meta_groups = Group.query.filter(Group.group_name.in_([u'anonymous', u'authenticated']))
groups = list(user.groups) + list(meta_groups)
return UserPermissions(user, cls(config), groups=groups)
示例3: add_default_data
# 需要导入模块: from mediadrop.model import User [as 别名]
# 或者: from mediadrop.model.User import user_name [as 别名]
def add_default_data():
log.info('Adding default data')
settings = [
(u'email_media_uploaded', None),
(u'email_comment_posted', None),
(u'email_support_requests', None),
(u'email_send_from', u'[email protected]'),
(u'wording_user_uploads', N_(u"Upload your media using the form below. We'll review it and get back to you.")),
(u'wording_administrative_notes', None),
(u'wording_display_administrative_notes', u''),
(u'popularity_decay_exponent', u'4'),
(u'popularity_decay_lifetime', u'36'),
(u'rich_text_editor', u'tinymce'),
(u'google_analytics_uacct', u''),
(u'featured_category', u'1'),
(u'max_upload_size', u'314572800'),
(u'ftp_storage', u'false'),
(u'ftp_server', u'ftp.someserver.com'),
(u'ftp_user', u'username'),
(u'ftp_password', u'password'),
(u'ftp_upload_directory', u'media'),
(u'ftp_download_url', u'http://www.someserver.com/web/accessible/media/'),
(u'ftp_upload_integrity_retries', u'10'),
(u'akismet_key', u''),
(u'akismet_url', u''),
(u'req_comment_approval', u''),
(u'use_embed_thumbnails', u'true'),
(u'api_secret_key_required', u'true'),
(u'api_secret_key', random_string(20)),
(u'api_media_max_results', u'50'),
(u'api_tree_max_depth', u'10'),
(u'general_site_name', u'MediaDrop'),
(u'general_site_title_display_order', u'prepend'),
(u'sitemaps_display', u'True'),
(u'rss_display', u'True'),
(u'vulgarity_filtered_words', u''),
(u'primary_language', u'en'),
(u'advertising_banner_html', u''),
(u'advertising_sidebar_html', u''),
(u'comments_engine', u'builtin'),
(u'facebook_appid', u''),
(u'youtube_apikey', u''),
]
settings.extend(appearance_settings)
for key, value in settings:
s = Setting()
s.key = key
s.value = value
DBSession.add(s)
admin_user = User()
admin_user.user_name = u'admin'
admin_user.display_name = u'Admin'
admin_user.email_address = u'[email protected]'
admin_user.password = u'admin'
DBSession.add(admin_user)
admin_group = Group(name=u'admins', display_name=u'Admins')
admin_group.users.append(admin_user)
DBSession.add(admin_group)
editor_group = Group(name=u'editors', display_name=u'Editors')
DBSession.add(editor_group)
anonymous_group = Group(name=u'anonymous', display_name=u'Everyone (including guests)')
DBSession.add(anonymous_group)
authenticated_group = Group(name=u'authenticated', display_name=u'Logged in users')
DBSession.add(authenticated_group)
admin_perm = Permission(name=u'admin', groups=[admin_group],
description=u'Grants access to the admin panel')
DBSession.add(admin_perm)
edit_perm = Permission(name=u'edit', groups=[admin_group, editor_group],
description=u'Grants access to edit site content')
DBSession.add(edit_perm)
view_perm = Permission(name=u'view',
groups=[admin_group, anonymous_group, editor_group],
description=u'View published media')
DBSession.add(view_perm)
upload_perm = Permission(name=u'upload',
groups=[admin_group, anonymous_group, editor_group],
description=u'Can upload new media')
DBSession.add(upload_perm)
media_upload_perm = Permission()
media_upload_perm.permission_name = u'MEDIA_UPLOAD'
media_upload_perm.description = u'Grants the ability to upload new media'
media_upload_perm.groups.append(admin_group)
media_upload_perm.groups.append(editor_group)
media_upload_perm.groups.append(anonymous_group)
DBSession.add(edit_perm)
category = Category(name=u'Featured', slug=u'featured')
DBSession.add(category)
#.........这里部分代码省略.........