本文整理汇总了Python中model.User.User.create方法的典型用法代码示例。如果您正苦于以下问题:Python User.create方法的具体用法?Python User.create怎么用?Python User.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.User.User
的用法示例。
在下文中一共展示了User.create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import create [as 别名]
def setUp( self ):
Test_controller.setUp( self )
Groups.urllib2 = Stub_urllib2
self.group_name = u"my group"
self.group_name2 = u"other group"
self.username = u"mulder"
self.password = u"trustno1"
self.email_address = u"[email protected]"
self.username2 = u"scully"
self.password2 = u"trustsome1"
self.email_address2 = u"[email protected]"
self.username3 = u"skinner"
self.password3 = u"trustne1"
self.email_address3 = u"[email protected]"
self.group = Group.create( self.database.next_id( Group ), self.group_name )
self.database.save( self.group, commit = False )
self.group2 = Group.create( self.database.next_id( Group ), self.group_name )
self.database.save( self.group2, commit = False )
self.user = User.create( self.database.next_id( User ), self.username, self.password, self.email_address )
self.database.save( self.user, commit = False )
self.database.execute( self.user.sql_save_group( self.group.object_id, admin = False ) )
self.user2 = User.create( self.database.next_id( User ), self.username2, self.password2, self.email_address2 )
self.database.save( self.user2, commit = False )
self.database.execute( self.user2.sql_save_group( self.group.object_id, admin = True ) )
self.user3 = User.create( self.database.next_id( User ), self.username3, self.password3, self.email_address3 )
self.database.save( self.user3, commit = False )
self.database.execute( self.user3.sql_save_group( self.group.object_id, admin = False ) )
self.database.commit()
示例2: setUp
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import create [as 别名]
def setUp( self ):
Test_controller.setUp( self )
self.notebook = Notebook.create( self.database.next_id( Notebook ), u"my notebook", trash_id = u"foo" )
self.database.save( self.notebook )
self.anon_notebook = Notebook.create( self.database.next_id( Notebook ), u"Luminotes" )
self.database.save( self.anon_notebook )
self.anon_note = Note.create(
self.database.next_id( Note ), u"<h3>my note</h3>",
notebook_id = self.anon_notebook.object_id,
)
self.database.save( self.anon_note )
self.login_note = Note.create(
self.database.next_id( Note ), u"<h3>login</h3>",
notebook_id = self.anon_notebook.object_id,
)
self.database.save( self.login_note )
self.blog_notebook = Notebook.create( self.database.next_id( Notebook ), u"Luminotes blog" )
self.database.save( self.blog_notebook )
self.blog_note = Note.create(
self.database.next_id( Note ), u"<h3>my blog entry</h3>",
notebook_id = self.blog_notebook.object_id,
)
self.database.save( self.blog_note )
self.guide_notebook = Notebook.create( self.database.next_id( Notebook ), u"Luminotes user guide" )
self.database.save( self.guide_notebook )
self.guide_note = Note.create(
self.database.next_id( Note ), u"<h3>it's all self-explanatory</h3>",
notebook_id = self.guide_notebook.object_id,
)
self.database.save( self.guide_note )
self.privacy_notebook = Notebook.create( self.database.next_id( Notebook ), u"Luminotes privacy policy" )
self.database.save( self.privacy_notebook )
self.privacy_note = Note.create(
self.database.next_id( Note ), u"<h3>yay privacy</h3>",
notebook_id = self.privacy_notebook.object_id,
)
self.database.save( self.privacy_note )
self.username = u"mulder"
self.password = u"trustno1"
self.email_address = u"[email protected]"
self.user = None
self.session_id = None
self.user = User.create( self.database.next_id( User ), self.username, self.password, self.email_address )
self.database.save( self.user )
self.database.execute( self.user.sql_save_notebook( self.notebook.object_id ) )
self.anonymous = User.create( self.database.next_id( User ), u"anonymous" )
self.database.save( self.anonymous )
self.database.execute( self.anonymous.sql_save_notebook( self.anon_notebook.object_id, read_write = False, owner = False, rank = 0 ) )
self.database.execute( self.anonymous.sql_save_notebook( self.blog_notebook.object_id, read_write = False, owner = False, rank = 1 ) )
self.database.execute( self.anonymous.sql_save_notebook( self.guide_notebook.object_id, read_write = False, owner = False, rank = 2 ) )
self.database.execute( self.anonymous.sql_save_notebook( self.privacy_notebook.object_id, read_write = False, owner = False, rank = 3 ) )
示例3: setUp
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import create [as 别名]
def setUp( self ):
self.database = Database(
Connection_wrapper( sqlite.connect( ":memory:", detect_types = sqlite.PARSE_DECLTYPES, check_same_thread = False ) ),
cache = Stub_cache(),
)
self.database.execute_script( file( "model/schema.sqlite" ).read(), commit = True )
self.username = u"mulder"
self.password = u"trustno1"
self.email_address = u"[email protected]"
self.user = User.create( self.database.next_id( User ), self.username, self.password, self.email_address )
self.database.save( self.user, commit = False )
self.trash = Notebook.create( self.database.next_id( Notebook ), u"trash" )
self.database.save( self.trash, commit = False )
self.notebook = Notebook.create( self.database.next_id( Notebook ), u"notebook", self.trash.object_id, user_id = self.user.object_id )
self.database.save( self.notebook, commit = False )
note_id = self.database.next_id( Note )
self.note1 = Note.create( note_id, u"<h3>my title</h3>blah", notebook_id = self.notebook.object_id, startup = True, user_id = self.user.object_id )
self.database.save( self.note1, commit = False )
note_id = self.database.next_id( Note )
self.note2 = Note.create( note_id, u"<h3>other title</h3>whee", notebook_id = self.notebook.object_id, user_id = self.user.object_id )
self.database.save( self.note2, commit = False )
示例4: create_anonymous_user
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import create [as 别名]
def create_anonymous_user( self ):
# create the anonymous user
anonymous_user_id = self.database.next_id( User )
self.anonymous = User.create( anonymous_user_id, u"anonymous", None, None )
self.database.save( self.anonymous, commit = False )
# give the anonymous user read-only access to the main notebook
self.database.execute( self.anonymous.sql_save_notebook( self.main_notebook.object_id, read_write = False, owner = False ), commit = False )
示例5: setUp
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import create [as 别名]
def setUp( self ):
self.object_id = u"17"
self.username = u"bob"
self.password = u"foobar"
self.email_address = u"[email protected]"
self.delta = timedelta( seconds = 1 )
self.user = User.create( self.object_id, self.username, self.password, self.email_address )
示例6: setUp
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import create [as 别名]
def setUp( self ):
Test_controller.setUp( self )
self.notebook = Notebook.create( self.database.next_id( Notebook ), u"my notebook", trash_id = u"foo" )
self.database.save( self.notebook )
self.anon_notebook = Notebook.create( self.database.next_id( Notebook ), u"Luminotes", trash_id = u"bar" )
self.database.save( self.anon_notebook )
self.anon_note = Note.create(
self.database.next_id( Note ), u"<h3>my note</h3>",
notebook_id = self.anon_notebook.object_id,
)
self.database.save( self.anon_note )
self.login_note = Note.create(
self.database.next_id( Note ), u"<h3>login</h3>",
notebook_id = self.anon_notebook.object_id,
)
self.database.save( self.login_note )
self.username = u"mulder"
self.password = u"trustno1"
self.email_address = u"[email protected]"
self.user = None
self.session_id = None
self.user = User.create( self.database.next_id( User ), self.username, self.password, self.email_address )
self.database.save( self.user )
self.database.execute( self.user.sql_save_notebook( self.notebook.object_id ) )
self.anonymous = User.create( self.database.next_id( User ), u"anonymous" )
self.database.save( self.anonymous )
self.database.execute( self.anonymous.sql_save_notebook( self.anon_notebook.object_id ) )
self.blog_user = User.create( self.database.next_id( User ), u"witten", self.password, self.email_address )
self.database.save( self.blog_user )
tag_id = self.database.next_id( Tag )
self.forum_tag = Tag.create(
tag_id,
notebook_id = None, # this tag is not in the namespace of a single notebook
user_id = self.anonymous.object_id,
name = u"forum",
description = u"a discussion forum"
)
self.database.save( self.forum_tag )
self.general_thread = Notebook.create( self.database.next_id( Notebook ), u"Welcome to the general forum!" )
self.database.save( self.general_thread )
self.database.execute(
self.anonymous.sql_save_notebook( self.general_thread.object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES ),
)
self.database.execute(
self.anonymous.sql_save_notebook_tag( self.general_thread.object_id, self.forum_tag.object_id, value = u"general" ),
)
self.support_thread = Notebook.create( self.database.next_id( Notebook ), u"Welcome to the support forum!" )
self.database.save( self.support_thread )
self.database.execute(
self.anonymous.sql_save_notebook( self.support_thread.object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES ),
)
self.database.execute(
self.anonymous.sql_save_notebook_tag( self.support_thread.object_id, self.forum_tag.object_id, value = u"support" ),
)
self.blog_thread = Notebook.create( self.database.next_id( Notebook ), u"Welcome to the blog!" )
self.database.save( self.blog_thread )
self.database.execute(
self.anonymous.sql_save_notebook( self.blog_thread.object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES ),
)
self.database.execute(
self.blog_user.sql_save_notebook( self.blog_thread.object_id, read_write = Notebook.READ_WRITE ),
)
self.database.execute(
self.anonymous.sql_save_notebook_tag( self.blog_thread.object_id, self.forum_tag.object_id, value = u"forum" ),
)