コード例 #1
0
ファイル: ircviews.py プロジェクト: cryogen/yardbird
def edit(request, key='', pattern='', replacement='', re_flags='',
         **kwargs):
    factoid = get_object_or_404(Factoid,
            fact__iexact=normalize_factoid_key(key))
    edited = factoid.edit_responses(pattern, re_flags, replacement,
            request.nick)
    if edited:
        return render_to_reply(request, 'factoid.irc',
                {'factoid': key, 'verb': edited.verb,
                    'text': edited.text})
    return render_error(request,
                        'No response in %s contained your pattern' % key)
コード例 #2
0
def edit(request, key='', pattern='', replacement='', re_flags='', **kwargs):
    factoid = get_object_or_404(Factoid,
                                fact__iexact=normalize_factoid_key(key))
    edited = factoid.edit_responses(pattern, re_flags, replacement,
                                    request.nick)
    if edited:
        return render_to_reply(request, 'factoid.irc', {
            'factoid': key,
            'verb': edited.verb,
            'text': edited.text
        })
    return render_error(request,
                        'No response in %s contained your pattern' % key)
コード例 #3
0
ファイル: stats.py プロジェクト: inversesquarelaw/yardbird
def gather_statistics(request, addressee='', template_name='stats.irc',
        context_instance=None):
    dictionary = {'statistics': []}
    for app in settings.INSTALLED_APPS:
        try:
            m = __import__(app + '.ircviews')
            if hasattr(m.ircviews, 'generate_statistics'):
                format_string, values = m.ircviews.generate_statistics()
                dictionary['statistics'].append(format_string % values)
        except ImportError:
            pass
    return render_to_reply(request, template_name, dictionary,
        context_instance)