Skip to content

Commit

Permalink
Fix issue with get_parent used in htmx integration
Browse files Browse the repository at this point in the history
Fixed field in get_parent method. Needs to be a string when testing for &. 

Also removed some left over print statements I'm guessing were used for debugging.
  • Loading branch information
jpsteil authored Jul 19, 2024
1 parent c658a46 commit 636fa7c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions py4web/utils/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,6 @@ def process(self):
else:
needed_fields = set()
for col in self.param.columns:
print("Column", col)
if isinstance(col, Column):
if col.required_fields:
needed_fields |= set(col.required_fields)
Expand All @@ -675,8 +674,6 @@ def process(self):
needed_fields.add(col)
self.needed_fields = list(needed_fields)

print(self.needed_fields)

# except the primary key may be missing and must be fetched even if not displayed
if not any(
getattr(col, "name", None) == table._id.name for col in self.needed_fields
Expand Down Expand Up @@ -838,8 +835,6 @@ def process(self):
self.page_end = self.total_number_of_rows

# get the data
print(self.needed_fields)
print(select_params)
self.rows = db(query).select(*self.needed_fields, **select_params)

self.number_of_pages = self.total_number_of_rows // self.param.rows_per_page
Expand Down Expand Up @@ -1662,8 +1657,8 @@ def get_parent(path, parent_field):
if "parent_id" in kvp:
parent_id = kvp.split("parent_id=")[1]

if parent_id and "&" in parent_id:
parent_id = parent_id.split("&")[0]
if parent_id and "&" in str(parent_id):
parent_id = str(parent_id).split("&")[0]

return parent_id

Expand Down

0 comments on commit 636fa7c

Please sign in to comment.