- 
                Notifications
    You must be signed in to change notification settings 
- Fork 28
Closed
Description
Background
Currently, the @override_for decorator only works for top-level domains. However, there are some cases wherein a site has multiple subdomains, usually per country (where each has a slightly different layout). This is due to the current setup of get_domain() (ref).
The problem lies in the following workaround due to limitations of the current @override_for decorator interface:
@override_for("example.com", AutoExtractArticleListData)
@attr.s(auto_attribs=True)
class ExampleArticleListPage(AutoExtractItemWebPage):
    article_list_data: AutoExtractArticleListData
    def to_item(self) -> ArticleList:
    	article_list = self.article_list_data.to_item()
    	if "uk.example.com" in self.url:
    		return self._handle_uk(article_list)
    	elif "au.example.com" in self.url:
    		return self._handle_uk(article_list)
    	elif "fr.example.com" in self.url:
    		return self._handle_fr(article_list)
    	return article_listObjectives
I'm wondering if it's worth it to update the current interface with something like this?
@override_for("example.com", AutoExtractArticleListData, subdomain="uk")
@override_for("example.com", AutoExtractArticleListData, subdomain="au")
@override_for("example.com", AutoExtractArticleListData, subdomain="fr")Depending on the situation, this provides another option on how to structure the collection of PageObjects in the project.
Metadata
Metadata
Assignees
Labels
No labels