[ Pobierz całość w formacie PDF ]
.This helps creating unique URLs." converters  A dict of converters that adds additional convert-ers to the list of converters.If you redefine one converter thiswill override the original one." sort_parameters  If set to True the url parameters are sorted.See url_encode for more details." sort_key  The sort key function for url_encode." encoding_errors  the error method to use for decoding" host_matching  if set to True it enables the host matching fea-ture and disables the subdomain one.If enabled the host pa-rameter to rules is used instead of the subdomain one.New in version 0.5: sort_parameters and sort_key was added.New in version 0.7:encoding_errors and host_matching was added.convertersThe dictionary of converters.This can be modified after the class was cre-ated, but will only affect rules added after the modification.If the rulesare defined with the list passed to the class, the converters parameter to theconstructor has to be used instead.76 add(rulefactory)Add a new rule or factory to the map and bind it.Requires that the rule isnot bound to another map.Parameters rulefactory  aRuleorRuleFactorybind(server_name, script_name=None, subdomain=None, url_scheme= http , de-fault_method= GET , path_info=None, query_args=None)Return a new MapAdapter with the details specified to the call.Notethat script_name will default to / if not further specified or None.Theserver_name at least is a requirement because the HTTP RFC requires abso-lute URLs for redirects and so all redirect exceptions raised by Werkzeugwill contain the full canonical URL.If no path_info is passed tomatch()it will use the default path info passed tobind.While this doesn t really make sense for manual bind calls, it s usefulif you bind a map to a WSGI environment which already contains the pathinfo.subdomain will default to the default_subdomain for this map if no defined.Ifthere is no default_subdomain you cannot use the subdomain feature.Newin version 0.7: query_args addedNew in version 0.8: query_args can now alsobe a string.bind_to_environ(environ, server_name=None, subdomain=None)Likebind()but you can pass it an WSGI environment and it will fetchthe information from that dictionary.Note that because of limitationsin the protocol there is no way to get the current subdomain and realserver_name from the environment.If you don t provide it, Werkzeug willuse SERVER_NAME and SERVER_PORT (or HTTP_HOST if provided) asused server_name with disabled subdomain feature.If subdomain is None but an environment and a server name is pro-vided it will calculate the current subdomain automatically.Example:server_name is  example.com and the SERVER_NAME in the wsgi en-viron is  staging.dev.example.com the calculated subdomain will be staging.dev.If the object passed as environ has an environ attribute, the value of this at-tribute is used instead.This allows you to pass request objects.AdditionallyPATH_INFO added as a default of theMapAdapterso that you don t have topass the path info to the match method.Changed in version 0.5: previ-ously this method accepted a bogus calculate_subdomain parameter that didnot have any effect.It was removed because of that.Changed in version 0.8:This will no longer raise a ValueError when an unexpected server name waspassed.Parameters" environ  a WSGI environment." server_name  an optional server name hint (see above)." subdomain  optionally the current subdomain (see above).77 default_converters= ImmutableDict({ int : , New in version 0.6: a dict of default converters to be used.is_endpoint_expecting(endpoint, *arguments)Iterate over all rules and check if the endpoint expects the arguments pro-vided.This is for example useful if you have some URLs that expect a lan-guage code and others that do not and you want to wrap the builder a bit sothat the current language code is automatically added if not provided butendpoints expect it.Parameters" endpoint  the endpoint to check." arguments  this function accepts one or more arguments aspositional arguments.Each one of them is checked.iter_rules(endpoint=None)Iterate over all rules or the rules of an endpoint.Parameters endpoint  if provided only the rules for that endpointare returned.Returns an iteratorupdate()Called before matching and building to keep the compiled rules in the cor-rect order after things changed.classwerkzeug.routing.MapAdapter(map, server_name, script_name, subdomain,url_scheme, path_info, default_method,query_args=None)Returned byMap.bind()orMap.bind_to_environ()and does the URL matchingand building based on runtime information.allowed_methods(path_info=None)Returns the valid methods that match for a given path.New in version 0.7.build(endpoint, values=None, method=None, force_external=False, ap-pend_unknown=True)Building URLs works pretty much the other way round.Instead of matchyou call build and pass it the endpoint and a dict of arguments for the place-holders.The build function also accepts an argument called force_external which, ifyou set it to True will force external URLs.Per default external URLs (in-clude the server name) will only be used if the target URL is on a differentsubdomain.>>> m = Map([ [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • lunamigotliwa.htw.pl
  •