Esempio n. 1
0
 def new(request, *args, **kwargs):
     if request.addressed:
         return function(request, *args, **kwargs)
     if "addressee" in kwargs and kwargs["addressee"]:
         return render_silence()
     else:
         return render_error(request, "You must address me to perform this operation.")
Esempio n. 2
0
def private_help(request):
    if not request.addressed:
        return render_silence()
    
    return IRCResponse(
    request.reply_recipient,
    "I'm a bot which finds entries in the django docs. Try writing '??serve'. For multiple terms, try '??admin,customizing'",
    'PRIVMSG')
Esempio n. 3
0
 def new(request, *args, **kwargs):
     if request.addressed:
         return function(request, *args, **kwargs)
     if 'addressee' in kwargs and kwargs['addressee']:
         return render_silence()
     else:
         return render_error(
             request, 'You must address me to perform this operation.')
Esempio n. 4
0
def documentation(request, terms):
    results = DocEntry.objects.search(terms.split(','))
    if not results:
        return render_silence()
        
    target_users = []
    start_match = user_start.search(request.message)
    if start_match:
        target_users.append(start_match.group(1))
    else:
        target_users.extend(user_at.findall(request.message))
    
    responses = []
    for result in results:
        responses.append("%s: %s" % (
            mark_safe(result.text), result.link))
    
    limit = 7 if request.addressed else 2    
    if len(responses) > limit:
        current_site = Site.objects.get_current()
        url = "http://%s%s" % (
            current_site.domain,
            reverse('search', kwargs={'terms':terms}))
        responses = responses[:limit]
        responses.append("There are %s more results for '%s', see %s for the full list." % (
            len(results)-limit, terms, url))
    
    response = '\n'.join(responses)
    if request.addressed:
        target = request.reply_recipient
    else:
        target = request.channel
        if target_users:
            response = ', '.join(target_users) + ': ' + response
    
    return IRCResponse(
        target, 
        mark_safe(response),
        'PRIVMSG')
Esempio n. 5
0
def test(request):
    print "test"
    return render_silence()
Esempio n. 6
0
def test(request):
    print "test"
    return render_silence()