This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reduce_function = bson.Code( | |
"function (key, values) {" | |
" var result = { tf: 0, df: 0};" | |
" values.forEach(function(value) {" | |
" result.tf += value.tf;" | |
" result.df = value.df;" | |
" });" | |
" return result;" | |
"}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map_function = bson.Code( | |
"function () {" | |
" for (var i=0; i < this.matches.length; i++) {" | |
" var match = this.matches[i];" | |
" var data = {tf: match.term_fq, df: this.document_fq};" | |
" emit(this.matches[i].doc_id, data);" | |
" }}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
term_document = dict( | |
term=token, | |
matches=[dict( | |
doc_id=document_id, | |
field_name=field_name, | |
original_word=original_word, | |
term_fq=frequency)], | |
document_fq=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for token in self.tokenizer(doc.get(field_name, '')): | |
original_word = token | |
for analyzer in self.analyzers: | |
token = analyzer(token) | |
processed_tokens[token] = processed_tokens.get(token, 0) + 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis | |
import logging | |
import redislog | |
import redislog.logger | |
logging.setLoggerClass(redislog.logger.RedisLogger) | |
LOGGING = { | |
'version': 1, | |
'formatters': { | |
'default': { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from redislog import handlers, logger | |
>>> l = logger.RedisLogger('my.logger') | |
>>> l.addHandler(handlers.RedisHandler.to("my:channel", host='localhost', port=6379, password='foobie')) | |
>>> l.info("I like pie") | |
>>> l.error("Trousers!", exc_info=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var source = new EventSource('/events'); | |
// Where on_message is some Javascript function to handle the message | |
source.addEventListener('message', on_message); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SSEHandler(tornado.web.RequestHandler): | |
def initialize(self): | |
self.set_header('Content-Type', 'text/event-stream') | |
self.set_header('Cache-Control', 'no-cache') | |
def emit(self, data, event=None): | |
""" | |
Actually emits the data to the waiting JS | |
""" | |
response = u'' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TornadoPubSub(redis.client.PubSub): | |
""" | |
PubSub handler that uses the IOLoop from tornado to read published messages | |
""" | |
_stream = None | |
def listen(self): | |
""" | |
Listen for messages by telling IOLoop what to call when data is there. | |
""" | |
if not self._stream: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/html/sites/all/modules/contrib/notifications/notifications_content/notifications_content.module b/html/sites/all/modules/contrib/notifications/notifications_content | |
index 3628cff..38232c8 100644 | |
--- a/html/sites/all/modules/contrib/notifications/notifications_content/notifications_content.module | |
+++ b/html/sites/all/modules/contrib/notifications/notifications_content/notifications_content.module | |
@@ -726,9 +726,13 @@ function notifications_content_nodeapi(&$node, $op, $arg = 0) { | |
function notifications_content_comment($comment, $op) { | |
// $comment can be an object or an array. | |
$comment = (object)$comment; | |
+ static $update_published_before = FALSE; | |
+ if ($op == 'update') { |