Пример #1
0
 def createSource(self, name, minerva_metadata, desc=''):
     user = self.getCurrentUser()
     folder = findSourceFolder(user, user, create=True)
     if folder is None:
         raise RestException('User has no Minerva Source folder.')
     source = self.model('item').createItem(name, user, folder, desc)
     updateMinervaMetadata(source, minerva_metadata)
     return source
Пример #2
0
 def listSources(self, user, params):
     folder = findSourceFolder(self.getCurrentUser(), user)
     if folder is None:
         return []
     else:
         limit, offset, sort = \
             self.getPagingParameters(params,
                                      defaultSortDir=pymongo.DESCENDING)
         items = [self.model('item').filter(item, self.getCurrentUser()) for
                  item in self.model('folder').childItems(folder,
                  limit=limit, offset=offset, sort=sort)]
         return items
Пример #3
0
 def createSourceFolder(self, user, params):
     folder = findSourceFolder(self.getCurrentUser(), user, create=True)
     return {'folder': folder}
Пример #4
0
 def getSourceFolder(self, user, params):
     folder = findSourceFolder(self.getCurrentUser(), user)
     return {'folder': folder}