laginha / yard Goto Github PK
View Code? Open in Web Editor NEWYet Another Restful Django Framework
Home Page: http://laginha.github.com/yard
License: MIT License
Yet Another Restful Django Framework
Home Page: http://laginha.github.com/yard
License: MIT License
In a resource, defining the fields attribute, something like this:
fields = ('name', ('author', ('name','gender')) )
won't work properly. However, everything works fine if you do:
fields = ( ('author', ('name','gender')), 'name' )
The problem lies in the build_json_tree algorithm within yard's resources.
Imagine the scenario where a Resource can only have one of the attributes:
from yard.resources.decorators import validate
from yard import forms, resources
class Dude(resources.Resource):
class Parameters:
full_name = forms.CharParam()
short_name = forms.CharParam()
__logic__ = full_name | short_name
@validate
def index(self, request, params):
if 'full_name' in params:
print 'Dude can write his name: {}'.format(params['full_name'])
else:
print 'Need to find full name of Dude called {}'.format(params['short_name'])
Now imagine you call http://api.example.com/dudes
without providing none of the parameters... It crashes when you try to do the params['short_name']
, with KeyError at /dudes/ 'short_name'
as its cause. It means params.is_valid()
in the decorator @validate
(yard/resources/decorators.py
) is returning True
, which means there's something wrong with the class OR
in yard/forms/parameter.py
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.