def page_view(url):
def decorator(func):<EOL><INDENT>@wraps(func)<EOL>async def wrapper(self: BaseState, *args, **kwargs):<EOL><INDENT>user_id = self.request.user.id<EOL>try:<EOL><INDENT>user_lang = await self.request.user.get_locale()<EOL><DEDENT>except NotImplementedError:<EOL><INDENT>user_lang = '<STR_LIT>'<EOL><DEDENT>title = self.__class__.__name__<EOL>async for p in providers():<EOL><INDENT>await p.page_view(url, title, user_id, user_lang)<EOL><DEDENT>return await func(self, *args, **kwargs)<EOL><DEDENT>return wrapper<EOL><DEDENT>return decorator<EOL>
Page view decorator.

Put that around a state handler function in order to log a page view each
time the handler gets called.

:param url: simili-URL that you want to give to the state