Opened 3 years ago

Last modified 2 years ago

#4687 closed change

Provide global index function in adblockplus/cms — at Version 2

Reported by: juliandoucette Assignee:
Priority: P2 Milestone:
Module: Sitescripts Keywords:
Cc: saroyanm, kvas, jsonesen, philll Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29370597/
https://codereview.adblockplus.org/29472555/

Description (last modified by juliandoucette)

Background

  • The new Help Center website categorizes pages by taxonomy like [product, platform, category, tag]
  • Several of the page templates required to build this website list pages based on these taxonomies
  • Therefore we must provide a method for adblockplus/cms to implement these lists using Jinja2

What to change

Provide the following global function:

def index(taxonomies):
    """Index pages by taxonomy.
    
    Args:
        taxonomies: A list of taxonomies
            List of strings: ["product", "platform"]
            List of tuple of strings: [("product", "adblock-plus"), "platform"]
    Returns:
        A list of pages for given taxonomies including given fields (in taxonomies)
            List of dicts: [{page: "acceptable-ads", product: "adblock-plus", platform: "firefox"}]
    Raises:
        TypeError: if taxonomies is not a list
        TypeError: if taxonomies list is formatted incorrectly
    """

Change History (2)

comment:1 Changed 3 years ago by juliandoucette

@jsonesen I added an extra requirement to the input (List of tuples which provides a default value to filter by) to the requirements. Please let me know if this is OK with you. We can simplify these requirements if needed.

comment:2 Changed 3 years ago by juliandoucette

  • Description modified (diff)
Note: See TracTickets for help on using tickets.