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)
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)
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)