Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
verson 20200712.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mdipierro committed Jul 12, 2020
1 parent 26b8065 commit 48b6d63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pydal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "20200711.1"
__version__ = "20200712.1"

from .base import DAL
from .objects import Field
Expand Down
8 changes: 4 additions & 4 deletions pydal/restapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Policy(object):
def __init__(self):
self.info = {}

def set(self, tablename, method, **attributes):
def set(self, tablename, method='GET', **attributes):
method = method.upper()
if not method in self.model:
raise InvalidFormat("Invalid policy method: %s" % method)
Expand Down Expand Up @@ -151,10 +151,10 @@ def check_if_lookup_allowed(self, tablename, exceptions=True):

def allowed_fieldnames(self, table, method="GET"):
method = method.upper()
policy = self.info.get(table._tablename) or self.info.get("*")
policy = self.info.get(table._tablename) or self.info.get("*", {})
policy = policy[method]
allowed_fieldnames = policy["fields"]
if not allowed_fieldnames:
allowed_fieldnames = policy.get("fields")
if allowed_fieldnames is None:
allowed_fieldnames = [
f.name
for f in table
Expand Down

0 comments on commit 48b6d63

Please sign in to comment.