本文整理匯總了Python中plone.app.drafts.interfaces.ICurrentDraftManagement.userId方法的典型用法代碼示例。如果您正苦於以下問題:Python ICurrentDraftManagement.userId方法的具體用法?Python ICurrentDraftManagement.userId怎麽用?Python ICurrentDraftManagement.userId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類plone.app.drafts.interfaces.ICurrentDraftManagement
的用法示例。
在下文中一共展示了ICurrentDraftManagement.userId方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_userId
# 需要導入模塊: from plone.app.drafts.interfaces import ICurrentDraftManagement [as 別名]
# 或者: from plone.app.drafts.interfaces.ICurrentDraftManagement import userId [as 別名]
def test_userId(self):
request = self.request
current = ICurrentDraftManagement(request)
self.assertEquals(TEST_USER_ID, current.userId)
current.userId = u"third-user"
self.assertEquals(u"third-user", current.userId)
示例2: test_userId
# 需要導入模塊: from plone.app.drafts.interfaces import ICurrentDraftManagement [as 別名]
# 或者: from plone.app.drafts.interfaces.ICurrentDraftManagement import userId [as 別名]
def test_userId(self):
request = self.app.REQUEST
current = ICurrentDraftManagement(request)
self.assertEquals(ptc.default_user, current.userId)
current.userId = u"third-user"
self.assertEquals(u"third-user", current.userId)
示例3: test_getCurrentDraft_draft_details_set_not_in_storage
# 需要導入模塊: from plone.app.drafts.interfaces import ICurrentDraftManagement [as 別名]
# 或者: from plone.app.drafts.interfaces.ICurrentDraftManagement import userId [as 別名]
def test_getCurrentDraft_draft_details_set_not_in_storage(self):
request = self.request
management = ICurrentDraftManagement(request)
management.userId = u"user1"
management.targetKey = u"123"
management.draftName = u"bogus"
draft = getCurrentDraft(request)
self.assertEquals(None, draft)
response = request.response
self.failIf('plone.app.drafts.targetKey' in response.cookies)
self.failIf('plone.app.drafts.draftName' in response.cookies)
示例4: test_getCurrentDraft_draft_details_set_in_storage_create
# 需要導入模塊: from plone.app.drafts.interfaces import ICurrentDraftManagement [as 別名]
# 或者: from plone.app.drafts.interfaces.ICurrentDraftManagement import userId [as 別名]
def test_getCurrentDraft_draft_details_set_in_storage_create(self):
request = self.request
inStorage = getUtility(IDraftStorage).createDraft(u"user1", u"123")
management = ICurrentDraftManagement(request)
management.userId = u"user1"
management.targetKey = u"123"
management.draftName = inStorage.__name__
draft = getCurrentDraft(request, create=True)
self.assertEquals(inStorage, draft)
response = request.response
self.failIf('plone.app.drafts.targetKey' in response.cookies)
self.failIf('plone.app.drafts.draftName' in response.cookies)
示例5: test_getCurrentDraft_draft_details_set_not_in_storage_create
# 需要導入模塊: from plone.app.drafts.interfaces import ICurrentDraftManagement [as 別名]
# 或者: from plone.app.drafts.interfaces.ICurrentDraftManagement import userId [as 別名]
def test_getCurrentDraft_draft_details_set_not_in_storage_create(self):
request = self.request
management = ICurrentDraftManagement(request)
management.userId = u"user1"
management.targetKey = u"123"
management.draftName = u"bogus"
draft = getCurrentDraft(request, create=True)
inStorage = getUtility(IDraftStorage).getDraft(u"user1", u"123", draft.__name__)
self.assertEquals(inStorage, draft)
response = request.response
self.failUnless('plone.app.drafts.targetKey' in response.cookies)
self.failUnless('plone.app.drafts.draftName' in response.cookies)
self.assertEquals('123', response.cookies['plone.app.drafts.targetKey']['value'])
self.assertEquals(draft.__name__, response.cookies['plone.app.drafts.draftName']['value'])
示例6: test_draft
# 需要導入模塊: from plone.app.drafts.interfaces import ICurrentDraftManagement [as 別名]
# 或者: from plone.app.drafts.interfaces.ICurrentDraftManagement import userId [as 別名]
def test_draft(self):
request = self.request
current = ICurrentDraftManagement(request)
self.assertEquals(None, current.draft)
current.userId = u"user1"
current.targetKey = u"123"
current.draftName = u"draft"
self.assertEquals(None, current.draft)
storage = getUtility(IDraftStorage)
created = storage.createDraft(u"user1", u"123")
current.draftName = created.__name__
self.assertEquals(created, current.draft)
newDraft = storage.createDraft(u"user1", u"123")
current.draft = newDraft
self.assertEquals(newDraft, current.draft)
示例7: _get_adapted_request
# 需要導入模塊: from plone.app.drafts.interfaces import ICurrentDraftManagement [as 別名]
# 或者: from plone.app.drafts.interfaces.ICurrentDraftManagement import userId [as 別名]
def _get_adapted_request(self):
# returns the adapted request for the draft stuff
adapted_request = ICurrentDraftManagement(self.request, None)
adapted_request.userId = getCurrentUserId()
adapted_request.targetKey = getDefaultKey(self.context)
return adapted_request