def updateResourceKeywords(self): resourceId = util.try_f(int, self.request('resource_id')) if (not self.user or not self.user.isResourceOwner(resourceId)): log.error("*** resource edit attempt without ownership, resource id %s" % resourceId) return False keywords = ' '.join([word.strip() for word in self.request('keywords').split(',')]) if not util.strNullOrEmpty(self.request('keywords')) else None return mProjectResource.updateProjectResourceTextData(self.db, resourceId, 'keywords', keywords)
def updateResourceAddress(self): resourceId = util.try_f(int, self.request('resource_id')) if (not self.user or not self.user.isResourceOwner(resourceId)): log.error("*** resource edit attempt without ownership, resource id %s" % resourceId) return False address = self.request('address') if (address): return mProjectResource.updateProjectResourceTextData(self.db, resourceId, 'physical_address', address) else: log.error("*** resource edit attempt without address, resource id %s" % resourceId) return False
def updateResourceContactEmail(self): resourceId = util.try_f(int, self.request('resource_id')) if (not self.user or not self.user.isResourceOwner(resourceId)): log.error("*** resource edit attempt without ownership, resource id %s" % resourceId) return False email = self.request('contactemail') if (email): return mProjectResource.updateProjectResourceTextData(self.db, resourceId, 'contact_email', email) else: log.error("*** resource edit attempt without email, resource id %s" % resourceId) return False
def updateResourceUrl(self): resourceId = util.try_f(int, self.request('resource_id')) if (not self.user or not self.user.isResourceOwner(resourceId)): log.error("*** resource edit attempt without ownership, resource id %s" % resourceId) return False url = self.request('url') if (url): return mProjectResource.updateProjectResourceTextData(self.db, resourceId, 'url', util.makeUrlAbsolute(url)) else: log.error("*** resource edit attempt without url, resource id %s" % resourceId) return False
def updateResourceDescription(self): resourceId = util.try_f(int, self.request('resource_id')) if (not self.user or not self.user.isResourceOwner(resourceId)): log.error("*** resource edit attempt without ownership, resource id %s" % resourceId) return False description = self.request('description') if (description): return mProjectResource.updateProjectResourceTextData(self.db, resourceId, 'description', description) else: log.error("*** resource edit attempt without description, resource id %s" % resourceId) return False
def updateResourceKeywords(self): resourceId = util.try_f(int, self.request('resource_id')) if (not self.user or not self.user.isResourceOwner(resourceId)): log.error( "*** resource edit attempt without ownership, resource id %s" % resourceId) return False keywords = ' '.join([ word.strip() for word in self.request('keywords').split(',') ]) if not util.strNullOrEmpty(self.request('keywords')) else None return mProjectResource.updateProjectResourceTextData( self.db, resourceId, 'keywords', keywords)
def updateResourceUrl(self): resourceId = util.try_f(int, self.request('resource_id')) if (not self.user or not self.user.isResourceOwner(resourceId)): log.error( "*** resource edit attempt without ownership, resource id %s" % resourceId) return False url = self.request('url') if (url): return mProjectResource.updateProjectResourceTextData( self.db, resourceId, 'url', util.makeUrlAbsolute(url)) else: log.error("*** resource edit attempt without url, resource id %s" % resourceId) return False
def updateResourceAddress(self): resourceId = util.try_f(int, self.request('resource_id')) if (not self.user or not self.user.isResourceOwner(resourceId)): log.error( "*** resource edit attempt without ownership, resource id %s" % resourceId) return False address = self.request('address') if (address): return mProjectResource.updateProjectResourceTextData( self.db, resourceId, 'physical_address', address) else: log.error( "*** resource edit attempt without address, resource id %s" % resourceId) return False
def updateResourceContactEmail(self): resourceId = util.try_f(int, self.request('resource_id')) if (not self.user or not self.user.isResourceOwner(resourceId)): log.error( "*** resource edit attempt without ownership, resource id %s" % resourceId) return False email = self.request('contactemail') if (email): return mProjectResource.updateProjectResourceTextData( self.db, resourceId, 'contact_email', email) else: log.error( "*** resource edit attempt without email, resource id %s" % resourceId) return False
def updateResourceDescription(self): resourceId = util.try_f(int, self.request('resource_id')) if (not self.user or not self.user.isResourceOwner(resourceId)): log.error( "*** resource edit attempt without ownership, resource id %s" % resourceId) return False description = self.request('description') if (description): return mProjectResource.updateProjectResourceTextData( self.db, resourceId, 'description', description) else: log.error( "*** resource edit attempt without description, resource id %s" % resourceId) return False