Ejemplo n.º 1
0
 def getContent(self):
     if not self.isValid():
         msg = getMessage(self.ctx, g_message, 121,
                          self.getContentIdentifier())
         raise IllegalIdentifierException(msg, self)
     content = Content(self.ctx, self)
     return content
Ejemplo n.º 2
0
 def queryContent(self, identifier):
     url = identifier.getContentIdentifier()
     if not identifier.isValid():
         msg = getMessage(self.ctx, g_message, 141, (url, self._error))
         logMessage(self.ctx, SEVERE, msg, 'ContentProvider',
                    'queryContent()')
         raise IllegalIdentifierException(msg, identifier)
     content = identifier.getContent()
     self._currentUserName = identifier.User.Name
     msg = getMessage(self.ctx, g_message, 142, url)
     logMessage(self.ctx, INFO, msg, 'ContentProvider', 'queryContent()')
     return content
Ejemplo n.º 3
0
 def queryContent(self, identifier):
     url = identifier.getContentIdentifier()
     print("ContentProvider.queryContent() %s" % url)
     if not identifier.IsInitialized:
         if not identifier.initialize(self._defaultUser):
             msg = "Identifier: %s ... Error: %s" % (url, identifier.Error)
             print("ContentProvider.queryContent() %s" % msg)
             logMessage(self.ctx, INFO, msg, 'ContentProvider',
                        'queryContent()')
             raise IllegalIdentifierException(identifier.Error, self)
     self._defaultUser = identifier.User.Name
     content = identifier.getContent()
     msg = "Identitifer: %s ... Done" % url
     logMessage(self.ctx, INFO, msg, 'ContentProvider', 'queryContent()')
     return content
Ejemplo n.º 4
0
 def queryContent(self, identifier):
     url = identifier.getContentIdentifier()
     print("ContentProvider.queryContent() 1 %s" % url)
     if not identifier.isValid():
         print("ContentProvider.queryContent() ERROR %s - %s" %
               (url, self._error))
         logMessage(self.ctx, SEVERE, msg, 'ContentProvider',
                    'queryContent()')
         raise IllegalIdentifierException(self._error, identifier)
     content = identifier.getContent()
     self._currentUserName = identifier.User.Name
     msg = "Identitifer: %s ... Done" % url
     logMessage(self.ctx, INFO, msg, 'ContentProvider', 'queryContent()')
     print("ContentProvider.queryContent() 2")
     return content
Ejemplo n.º 5
0
 def getContent(self):
     if self.isNew():
         data = self._getNewContent()
     else:
         data = self.User.DataBase.getItem(self.User.Id, self.Id)
         print("Identifier.getContent() %s" % data)
         #if data is None and self.User.Provider.isOnLine():
         #    data = self.User.Provider.getItem(self.User.Request, self.MetaData)
         #    if data.IsPresent:
         #        data = self.User.DataBase.insertAndSelectItem(self.User, data.Value)
     if data is None:
         msg = "Error: can't retreive Identifier"
         raise IllegalIdentifierException(msg, self)
     content = Content(self.ctx, self, data)
     print("Identifier.getContent() OK")
     return content