本文整理匯總了Python中tp.server.model.Model.refresh方法的典型用法代碼示例。如果您正苦於以下問題:Python Model.refresh方法的具體用法?Python Model.refresh怎麽用?Python Model.refresh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tp.server.model.Model
的用法示例。
在下文中一共展示了Model.refresh方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __call__
# 需要導入模塊: from tp.server.model import Model [as 別名]
# 或者: from tp.server.model.Model import refresh [as 別名]
def __call__( self, request ):
Object = self.model.use( self.__object__ )
response = []
for id in request.ids:
obj = self.fetch( Object, id )
# WARNING: This is only for testing purposes!
Model.refresh( obj )
if obj:
if self.authorize( obj ):
response.append( self.process( request, obj ) )
else:
debug( "No permission for %s with id %s.", Object.__origname__, id )
response.append( self.Fail( request, "PermissionDenied", "You cannot access %s with id = %d." % ( Object.__origname__, id ) ) )
else:
debug( "No such %s with id %s.", Object.__origname__, id )
response.append( self.Fail( request, "NoSuchThing", "No %s with id = %d." % ( Object.__origname__, id ) ) )
if len( response ) > 1:
response.insert( 0, self.Sequence( request, len( response ) ) )
if not len( response ):
response.append( self.Fail( request, "Protocol", "List of IDs must be nonempty!" ) )
return response