Moved .execute() method from BaseView to Datasette class

Also introduced new Results() class with results.truncated, results.description, results.rows
This commit is contained in:
Simon Willison 2018-05-24 17:15:37 -07:00
commit 81df47e8d9
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52
4 changed files with 105 additions and 90 deletions

View file

@ -36,6 +36,19 @@ class InterruptedError(Exception):
pass
class Results:
def __init__(self, rows, truncated, description):
self.rows = rows
self.truncated = truncated
self.description = description
def __iter__(self):
return iter(self.rows)
def __len__(self):
return len(self.rows)
def urlsafe_components(token):
"Splits token on commas and URL decodes each component"
return [