def create(self, app, action, **params): owner = splunk.auth.getCurrentUser()['name'] message = Message(app, owner, **params) if message.value is None or len(message.value)==0: message.errors = [_('Please enter a value for your post')] else: url = "/app/search/flashtimeline?%s" % urllib.urlencode({"q": "search index=_* %s" % owner}) label = "@%s" % owner wikified = "[[%s|%s]] %s" % (url, label, message.value) message.value = wikified if not message.errors and message.passive_save(): raise cherrypy.HTTPRedirect(self.make_url(['wall', app, 'success']), 303) return self.render_template('wall/new.html', dict(app=app, message=message))
def success(self, app, action, **params): messages = [message.entity[message.name] for message in Message.all()] message_value = None if messages > 0: message_value = messages[0] return self.render_template('wall/success.html', dict(app=app, message_value=message_value))
def create(self, app, action, **params): owner = splunk.auth.getCurrentUser()['name'] message = Message(app, owner, **params) if message.value is None or len(message.value) == 0: message.errors = [_('Please enter a value for your post')] else: url = "/app/search/flashtimeline?%s" % urllib.urlencode( {"q": "search index=_* %s" % owner}) label = "@%s" % owner wikified = "[[%s|%s]] %s" % (url, label, message.value) message.value = wikified if not message.errors and message.passive_save(): raise cherrypy.HTTPRedirect( self.make_url(['wall', app, 'success']), 303) return self.render_template('wall/new.html', dict(app=app, message=message))
def new(self, app, action, **params): owner = splunk.auth.getCurrentUser()['name'] try: message = Message(app, owner, '', **params) except splunk.AuthorizationFailed: error = _("We're sorry you do not have permissions to use Wall.") return self.render_template('wall/error.html', dict(app=app, error=error)) except Exception: error = _("We're sorry Wall is unavailable.") return self.render_template('wall/error.html', dict(app=app, error=error)) else: return self.render_template('wall/new.html', dict(app=app, message=message))
def delete_message(self, action, **params): message = Message.get(params.get('message_id')) message.delete()
def success(self, app, action, **params): messages = [message.entity[message.name] for message in Message.all()] message_value = None if messages>0: message_value = messages[0] return self.render_template('wall/success.html', dict(app=app, message_value=message_value))