Page MenuHomePhabricator

Document changes to code
Closed, ResolvedPublic3 Estimated Story Points

Description

Go through the changes that we've done to the code and document:

  • What is done differently and how.
  • What functionality, that was part of the original code, is disabled because we didn't need it at this point.

Outcome

Our changes have only been to the "Talk page invitation" functionality, this is also the only bit which has been tested and confirmed to still work.

Overwiev of changes

  • Broke out send_invites command line call to bash file (adds timestamps to log and implifies cron call)
  • Created bash script for setting up virtual environemnt with correct version of Python and dependencies
  • Add SQL file for setting up basic table [auto-increment now starts from 1]
  • Make dependencies explicit in requirements.txt
  • Log-in via OAuth
  • Broken out any site or run specific parameters to hb_config (e.g. inviters, message, max_user_age, edit summary etc.). Also provided a method for loading some of these from Wiki pages
  • Added functionality for reading values from wiki-pages. These can be plain text, lists or JSON.
  • Created a template SQL query to cover previously hardcoded queries. Unused queries were removed. (Keys in query dict still use old teahouse names, references to these are hard-coded.)
  • Set config file via cmd line argument
  • Standardising indentation and code style (PEP8) where this touched on changed code.
  • Removed some unused function parameters.
  • Made some api querying more robust against missing users, pages etc.
  • Differentiate handling of templates and strings on user talk page which disqualify them from being invited.
  • Basic sanity check that messages/summaries don't refer to a named inviter if no inviters have been provided.
  • Improved logging (replacing prints)
  • Throttle added to api write actions

Expanded comments

New hb_config variables are documented in hb_config.sample.py (note file extension). Sample usage of function in page_reader (see below) is also shown in hb_config.sample.py.

A module, page_reader, was added to read variables from
wiki-pages. This makes it possible to make config changes without
having to a new commit. This also makes it easier for community
administrators to make these changes, without having to understand the
code. All variables can still be defined in hb_config. A page can be
read as raw text, as a list, where one row equals one item or as JSON.

Having inviters is now optional. The invitation message may contain a
replacement field for inviter. If so, a list of inviters is required
and the field will be replaced by one of these.

Event Timeline

Jopparn changed the point value for this task from 4 to 3.Feb 13 2017, 11:04 AM
Jopparn subscribed.

Sebastian and André will have a meeting (1.5 hours) to discuss next steps this week, so 3 hours are added to the Story Point. Last week Sebastian worked 4 hours on the task.

Main documentation done. Left in task is to

  • Find suitable on-wiki place for the documentation (under the right project)
  • Use documentation in T157782: Enquire about code merge
  • Remember to update unmerged/planned (on-wiki) after last merges

Main documentation done. Left in task is to

  • Find suitable on-wiki place for the documentation (under the right project)
  • Done
  • Remember to update unmerged/planned (on-wiki) after last merges
Lokal_Profil updated the task description. (Show Details)
  • Remember to update unmerged/planned (on-wiki) after last merges

Done