Comments (8)
are thinking of just a "read-only" flag per model, or something more
fine-grained?
Original comment by [email protected]
on 25 Aug 2009 at 12:26
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
from appengine-rest-server.
good question, personally I only have value in read only. I don't know if
denying
updates or deletes is valuable too. It probably would run the same codepath
though,
so maybe it'd be worthwhile just to add in the generic support
rest.Dispatcher.add_models({"things": (models.Thing,["GET","DELETE])})
Original comment by [email protected]
on 25 Aug 2009 at 2:13
from appengine-rest-server.
I'd love to have something like that: a list of supported operations.
Along the lines of Richard's suggestion:
* defining method types (rest.GET, rest.DELETE, rest.POST, rest.PUT)
* support for an optional 'supported methods' list, eg:
* rest.Dispatcher.add_models({"things": (models.Thing,[rest.GET, rest.DELETE])})
* rest.Dispatcher.add_models({"widgets": (models.Widget,[rest.GET])})
* rest.Dispatcher.add_models({"thingamies": models.Thingamie})
I'm happy to give it a shot myself and submit it as a patch.
Just let me know where to start (I already have a copy of the latest 1.0.2 zip
file).
Original comment by [email protected]
on 9 Jul 2010 at 7:30
from appengine-rest-server.
This should be pretty straightforward. every type gets associated with a
ModelHandler. you basically just need to store the "allowed" operations in the
ModelHandler and check that collection in the Dispatcher.get_model_handler
method (where that method would have an extra param indicating the intended
operation).
Original comment by [email protected]
on 9 Jul 2010 at 12:32
from appengine-rest-server.
Done. I made the changes so that they were optional and will have no impact on
existing users.
The following is now possible:
# add specific models (with given names) and restrict the supported methods
rest.Dispatcher.add_models({
'foo' : (FooModel, ["GET"]),
'bar' : (BarModel, ["GET", "POST", "PUT"],
'cache' : (CacheModel, ["GET", "DELETE"] })
(that's from the example I added to the doc string of __init__.py)
I didn't do the check in Dispatch.get_model_handler as that would have meant
adding special-case code for the metadata stuff. Instead, I simply check the
desired method is in the list of supported methods after calling
get_model_handler. If the method is not supported, I return error 405 Method
Not Allowed.
I've attached the updated __init__.py.
Original comment by [email protected]
on 10 Jul 2010 at 1:23
Attachments:
from appengine-rest-server.
Before I forget, I also changed some of the logging.info calls. They weren't
using % to construct the format strings.
Original comment by [email protected]
on 10 Jul 2010 at 1:26
from appengine-rest-server.
so, i incorporated these changes with some slight mods. i did put the check in
the get_model_handler method, and i added support for a synthetic
"GET_METADATA" method which allows controlling of retrieval of the object
metadata. there are also 2 list constants in the package which incorporate
some common scenarios:
ALL_MODEL_METHODS = ["GET", "POST", "PUT", "DELETE", "GET_METADATA"]
READ_ONLY_MODEL_METHODS = ["GET", "GET_METADATA"]
Original comment by [email protected]
on 12 Jul 2010 at 1:36
- Changed state: Fixed
from appengine-rest-server.
That's great! Thanks!
Original comment by [email protected]
on 12 Jul 2010 at 12:19
from appengine-rest-server.
Related Issues (20)
- Implement Python Unit Tests HOT 1
- Package new version HOT 3
- No JSON object could be decoded HOT 4
- Setting caching = True causes AttributeError: 'Response' object has no attribute 'getvalue' HOT 4
- The server runs ik but the authorizer class you provided doest seem to work.I can still access my model without login. HOT 7
- Detailed Documentation HOT 10
- Problem with POST method HOT 7
- use <list> for metadata HOT 1
- ETag / If-None-Match support HOT 4
- JSON usage HOT 2
- Nested results using reference property HOT 5
- Initial Setup & Install HOT 2
- Allow using key name (or integer ID) when referencing entities HOT 3
- JSON Query responses that return one data object are not correctly serialised HOT 2
- GET Broken: Syntax error introduced in r121 HOT 1
- TypeError: unbound method set_response_content_type HOT 1
- Remove "Item" nodes in json HOT 12
- Paging and memcache HOT 1
- Need to return a count of the results in total. HOT 2
- Uploading images to BlobInfo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from appengine-rest-server.