English Wikipedia @ Freddythechick:Huggle/Extensions/huggle logs.py

From English Wikipedia @ Freddythechick

Lua error in Module:Effective_protection_level at line 63: attempt to index field 'TitleBlacklist' (a nil value). This extension will write to a log on your userpage everytime you request a deletion of some page. You can install it by copy pasting the code bellow and writing it as "huggle_log.py" to your extensions folder (by default ~/.local/shared/Wikimedia/Huggle/extensions on linux and AppData/Local/Wikimedia/Huggle/extensions on windows)

Bellow is a code of the extension: <syntaxhighlight lang=python>

  1. !/bin/echo This is a huggle extension, please use huggle instead

import huggle import datetime

  1. this module will write to a log on wiki everytime you tag a page for speedy

wiki_log = "/CSD_log"; log_summary = "Logging speedy deletion nomination of $1";

def get_author():

   return "Petr Bena";

def get_version():

   return "1.0.0.0";

def get_description():

   return "This extension will write to " + wiki_log + " everytime you tag a page for speedy deletion";

def get_minimal_huggle_version():

   return "3.1.10";
  1. override the hook where we finish tagging a page

def hook_speedy_finished(page, user, tags, result):

   if (result != "success"):
       # there is nothing to do for us
       huggle.debug_log("Ignored unsuccessful tag of " + page + " (result was: " + result + ")", 1);
       return "";
   huggle.debug_log("logging " + page, 1);
   # let's get a name of page
   page_name = "User:" + huggle.configuration_get_user() + wiki_log;
   # create a summary
   summary = log_summary.replace("$1", page);
   # append this text to bottom of the page
   huggle.wikipage_append(page_name, "# " + page + " using " + tags + "; notified " + user + " (talk · contribs) " + 
                          str(datetime.datetime.now()) + "\n", summary);
   return "";

</syntaxhighlight >