File tree Expand file tree Collapse file tree 2 files changed +11
-15
lines changed
Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -64,10 +64,8 @@ async def partials_endpoint(
6464 return AffiliateLinksPartial (data = parsed_data ).generate ()
6565
6666 elif _component == "BPListsSection" :
67- # Use separate query parameters
68- return BookPageListsPartial (
69- data = {"workId" : workId , "editionId" : editionId }
70- ).generate ()
67+ # Pass parameters directly - much simpler!
68+ return BookPageListsPartial (workId = workId , editionId = editionId ).generate ()
7169
7270 elif _component == "FulltextSearchSuggestion" :
7371 # data is just a string, not JSON
Original file line number Diff line number Diff line change @@ -303,21 +303,19 @@ def generate(self) -> dict:
303303class BookPageListsPartial (PartialDataHandler ):
304304 """Handler for rendering the book page "Lists" section"""
305305
306- def __init__ (self , data : dict | None = None ):
307- if data is None :
308- self .i = web .input (workId = "" , editionId = "" )
309- self .data = {
310- "workId" : self .i .workId ,
311- "editionId" : self .i .editionId ,
312- }
306+ def __init__ (self , workId : str = "" , editionId : str = "" ):
307+ if not workId and not editionId :
308+ # Only read from web.input if no params provided
309+ i = web .input (workId = "" , editionId = "" )
310+ self .workId = i .workId
311+ self .editionId = i .editionId
313312 else :
314- self .data = data
313+ self .workId = workId
314+ self .editionId = editionId
315315
316316 def generate (self ) -> dict :
317317 results : dict = {"partials" : []}
318- work_key = self .data .get ("workId" , "" )
319- edition_key = self .data .get ("editionId" , "" )
320- keys = [k for k in (work_key , edition_key ) if k ]
318+ keys = [k for k in (self .workId , self .editionId ) if k ]
321319
322320 # Do checks and render
323321 lists = get_lists (keys )
You can’t perform that action at this time.
0 commit comments