The heuristics used by the analyzer are based on detecting (unit-test) library imports, and file and path naming conventions as summarized in the table below:
|FileContent||from unittest import||12|
|FileContent||from nose.tools import||12|
What results can you expect?
The following structural rules are provided:
NOTE: Support for Falcon is expected to be released in 1.4.0-beta6beta7.
Falcon route annotations for web service operations (GET, PUT, POST, DELETE) are supported.
In the following example, a default GET operation is ascribed to the functionon_get from GetResourceclass,and the POST and PUT operations to the on_putandon_postfunctions fromPut_PostResourcewith two differents urls routing:
The link between the GET operation named after the routing URL "/" and the called functionon_get is represented by an arrow pointing to the function:
The name of a saved Web Service Operation object will be generated from the routing URL by adding a final slash when not present. In this example the name of the POST operations is "/url/example/1/" and "/url/example/2/" after the routing url "/url/example/1" and "/url/example/2".
Sinks are supported with the following rules : If no route matches a request, but the path in the requested URI matches a sink prefix, Falcon will pass control to the associated sink, regardless of the HTTP method requested. If the prefix overlaps a registered route template, the route will take precedence and mask the sink.
In this case Web Service Operation objects generated as sinks will be named as/that/, and not as/this/since another Web Service Operation object exists with an overlapping url.
importfalcon app=falcon.App() class GetResource(): def on_get(): print('on_get function') def sink_method(resp,**kwargs): resp.body="Sink" pass app.add_route('this/is/the/way', GetResource()) app.add_sink(sink_method, prefix='/that') # get, post, put & delete routes will be created and linked to sink_method app.add_sink(sink_method, prefix='/this') # no routes created because Url overlaps another route
The optional suffix keyword argument of Falcon add_route is supported. In this way, multiple closely-related routes can be mapped to the same resource.