code stringlengths 1 18.2k |
|---|
def getInitialLiveForms(self): """ Make and return as many L{LiveForm} instances as are necessary to hold our default values. @return: some subforms. @rtype: C{list} of L{LiveForm} """ liveForms = [] if self._defaultStuff: for values in self._defaultStuff: liveForms.append(self._makeDefaultLiveForm(values)) else: # or ... |
def _coerceSingleRepetition(self, dataSet): """ Make a new liveform with our parameters, and get it to coerce our data for us. """ # make a liveform because there is some logic in _coerced form = LiveForm(lambda **k: None, self.parameters, self.name) return form.fromInputs(dataSet) |
def _extractCreations(self, dataSets): """ Find the elements of C{dataSets} which represent the creation of new objects. @param dataSets: C{list} of C{dict} mapping C{unicode} form submission keys to form submission values. @return: iterator of C{tuple}s with the first element giving the opaque identifier of an object ... |
def _coerceAll(self, inputs): """ XXX """ def associate(result, obj): return (obj, result) coerceDeferreds = [] for obj, dataSet in inputs: oneCoerce = self._coerceSingleRepetition(dataSet) oneCoerce.addCallback(associate, obj) coerceDeferreds.append(oneCoerce) return gatherResults(coerceDeferreds) |
def coercer(self, dataSets): """ Coerce all of the repetitions and sort them into creations, edits and deletions. @rtype: L{ListChanges} @return: An object describing all of the creations, modifications, and deletions represented by C{dataSets}. """ # Xxx - This does a slightly complex (hey, it's like 20 lines, how # c... |
the user is triggering in the browser so that it could keep state for # adds/deletes/edits separately from DOM and widget objects. This # would remove the need for RepeatedLiveFormWrapper. def makeSetter(identifier, values): def setter(defaultObject): self._idsToObjects[identifier] = defaultObject self._lastValues[iden... |
def fromInputs(self, inputs): """ Extract the inputs associated with this parameter from the given dictionary and coerce them using C{self.coercer}. @type inputs: C{dict} mapping C{str} to C{list} of C{str} @param inputs: The contents of a form post, in the conventional structure. @rtype: L{Deferred} @return: A Deferre... |
def clone(self, choices): """ Make a copy of this parameter, supply different choices. @param choices: A sequence of L{Option} instances. @type choices: C{list} @rtype: L{ChoiceParameter} """ return self.__class__( self.name, choices, self.label, self.description, self.multiple, self.viewFactory) |
def compact(self): """ Switch to the compact variant of the live form template. By default, this will simply create a loader for the C{self.compactFragmentName} template and compact all of this form's parameters. """ self.docFactory = webtheme.getLoader(self.compactFragmentName) for param in self.parameters: param.comp... |
def asSubForm(self, name): """ Make a form suitable for nesting within another form (a subform) out of this top-level liveform. @param name: the name of the subform within its parent. @type name: C{unicode} @return: a subform. @rtype: L{LiveForm} """ self.subFormName = name self.jsClass = _SUBFORM_JS_CLASS return self |
def submitbutton(self, request, tag): """ Render an INPUT element of type SUBMIT which will post this form to the server. """ return tags.input(type='submit', name='__submit__', value=self._getDescription()) |
def form(self, request, tag): """ Render the inputs for a form. @param tag: A tag with: - I{form} and I{description} slots - I{liveform} and I{subform} patterns, to fill the I{form} slot - An I{inputs} slot, to fill with parameter views - L{IParameterView.patternName}I{-input-container} patterns for each parameter type... |
def invoke(self, formPostEmulator): """ Invoke my callable with input from the browser. @param formPostEmulator: a dict of lists of strings in a format like a cgi-module form post. """ result = self.fromInputs(formPostEmulator) result.addCallback(lambda params: self.callable(**params)) return result |
def fromInputs(self, received): """ Convert some random strings received from a browser into structured data, using a list of parameters. @param received: a dict of lists of strings, i.e. the canonical Python form of web form post. @rtype: L{Deferred} @return: A Deferred which will be called back with a dict mapping pa... |
def label(self, request, tag): """ Render the label of the wrapped L{Parameter} or L{ChoiceParameter} instance. """ if self.parameter.label: tag[self.parameter.label] return tag |
def description(self, request, tag): """ Render the description of the wrapped L{Parameter} instance. """ if self.parameter.description is not None: tag[self.parameter.description] return tag |
def realForm(self, req, tag): """ Render L{liveForm}. """ self.liveForm.setFragmentParent(self) return self.liveForm |
def default(self, request, tag): """ Render the initial value of the wrapped L{Parameter} instance. """ if self.parameter.default is not None: tag[self.parameter.default] return tag |
def selected(self, request, tag): """ Render a selected attribute on the given tag if the wrapped L{Option} instance is selected. """ if self.option.selected: tag(selected='selected') return tag |
def multiple(self, request, tag): """ Render a I{multiple} attribute on the given tag if the wrapped L{ChoiceParameter} instance allows multiple selection. """ if self.parameter.multiple: tag(multiple='multiple') return tag |
def options(self, request, tag): """ Render each of the options of the wrapped L{ChoiceParameter} instance. """ option = tag.patternGenerator('option') return tag[[ OptionView(index, o, option()) for (index, o) in enumerate(self.parameter.choices)]] |
def forms(self, req, tag): """ Make and return some forms, using L{self.parameter.getInitialLiveForms}. @return: some subforms. @rtype: C{list} of L{LiveForm} """ liveForms = self.parameter.getInitialLiveForms() for liveForm in liveForms: liveForm.setFragmentParent(self) return liveForms |
def repeatForm(self): """ Make and return a form, using L{self.parameter.asLiveForm}. @return: a subform. @rtype: L{LiveForm} """ liveForm = self.parameter.asLiveForm() liveForm.setFragmentParent(self) return liveForm |
def repeater(self, req, tag): """ Render some UI for repeating our form. """ repeater = inevow.IQ(self.docFactory).onePattern('repeater') return repeater.fillSlots( 'object-description', self.parameter.modelObjectDescription) |
def input(self, request, tag): """ Add the wrapped form, as a subform, as a child of the given tag. """ subform = self.parameter.form.asSubForm(self.parameter.name) subform.setFragmentParent(self) return tag[subform] |
def generateVectors(): """Convert the known ra/decs of the channel corners into unit vectors. This code creates the conents of the function loadOriginVectors() (below) """ ra_deg = 290.66666667 dec_deg = +44.5 #rollAngle_deg = 33.0 rollAngle_deg = +123. boresight = r.vecFromRaDec(ra_deg, dec_deg) #Read in prime mission... |
%13.7f, %13.7f, %13.7f], \\" %( \ inFile[i, 0], inFile[i, 1], ch, \ origin[i, 0], origin[i, 1], origin[i,2])) print("]") |
def get_arrive_stop(self, **kwargs): """Obtain bus arrival info in target stop. Args: stop_number (int): Stop number to query. lang (str): Language code (*es* or *en*). Returns: Status boolean and parsed response (list[Arrival]), or message string in case of error. """ # Endpoint parameters params = { 'idStop': kwargs.... |
def get_groups(self, **kwargs): """Obtain line types and details. Args: lang (str): Language code (*es* or *en*). Returns: Status boolean and parsed response (list[GeoGroupItem]), or message string in case of error. """ # Endpoint parameters params = { 'cultureInfo': util.language_code(kwargs.get('lang')) } # Request r... |
def get_info_line(self, **kwargs): """Obtain basic information on a bus line on a given date. Args: day (int): Day of the month in format DD. The number is automatically padded if it only has one digit. month (int): Month number in format MM. The number is automatically padded if it only has one digit. year (int): Year... |
'get_info_line', **params) # Funny endpoint, no status code if not util.check_result(result, 'Line'): return False, 'UNKNOWN ERROR' # Parse values = util.response_list(result, 'Line') return True, [emtype.Line(**a) for a in values] |
def get_poi(self, **kwargs): """Obtain a list of POI in the given radius. Args: latitude (double): Latitude in decimal degrees. longitude (double): Longitude in decimal degrees. types (list[int] | int): POI IDs (or empty list to get all). radius (int): Radius (in meters) of the search. lang (str): Language code (*es* o... |
def get_poi_types(self, **kwargs): """Obtain POI types. Args: lang (str): Language code (*es* or *en*). Returns: Status boolean and parsed response (list[PoiType]), or message string in case of error. """ # Endpoint parameters params = { 'cultureInfo': util.language_code(kwargs.get('lang')) } # Request result = self.ma... |
def get_route_lines_route(self, **kwargs): """Obtain itinerary for one or more lines in the given date. Args: day (int): Day of the month in format DD. The number is automatically padded if it only has one digit. month (int): Month number in format MM. The number is automatically padded if it only has one digit. year (... |
ERROR') # Parse values = util.response_list(result, 'resultValues') return True, [emtype.RouteLinesItem(**a) for a in values] |
def get_stops_line(self, **kwargs): """Obtain information on the stops of the given lines. Arguments: lines (list[int] | int): Lines to query, may be empty to get all the lines. direction (str): Optional, either *forward* or *backward*. lang (str): Language code (*es* or *en*). Returns: Status boolean and parsed respon... |
def get_street(self, **kwargs): """Obtain a list of nodes related to a location within a given radius. Not sure of its use, but... Args: street_name (str): Name of the street to search. street_number (int): Street number to search. radius (int): Radius (in meters) of the search. stops (int): Number of the stop to searc... |
def get_street_from_xy(self, **kwargs): """Obtain a list of streets around the specified point. Args: latitude (double): Latitude in decimal degrees. longitude (double): Longitude in decimal degrees. radius (int): Radius (in meters) of the search. lang (str): Language code (*es* or *en*). Returns: Status boolean and pa... |
def harvest_fundref(source=None): """Harvest funders from FundRef and store as authority records.""" loader = LocalFundRefLoader(source=source) if source \ else RemoteFundRefLoader() for funder_json in loader.iter_funders(): register_funder.delay(funder_json) |
def harvest_openaire_projects(source=None, setspec=None): """Harvest grants from OpenAIRE and store as authority records.""" loader = LocalOAIRELoader(source=source) if source \ else RemoteOAIRELoader(setspec=setspec) for grant_json in loader.iter_grants(): register_grant.delay(grant_json) |
def harvest_all_openaire_projects(): """Reharvest all grants from OpenAIRE. Harvest all OpenAIRE grants in a chain to prevent OpenAIRE overloading from multiple parallel harvesting. """ setspecs = current_app.config['OPENAIRE_GRANTS_SPECS'] chain(harvest_openaire_projects.s(setspec=setspec) for setspec in setspecs).app... |
def create_or_update_record(data, pid_type, id_key, minter): """Register a funder or grant.""" resolver = Resolver( pid_type=pid_type, object_type='rec', getter=Record.get_record) try: pid, record = resolver.resolve(data[id_key]) data_c = deepcopy(data) del data_c['remote_modified'] record_c = deepcopy(record) del reco... |
def IS(instance, other): # noqa """ Support the `future is other` use-case. Can't override the language so we built a function. Will work on non-future objects too. :param instance: future or any python object :param other: object to compare. :return: """ try: instance = instance._redpipe_future_result # noqa except At... |
def ISINSTANCE(instance, A_tuple): # noqa """ Allows you to do isinstance checks on futures. Really, I discourage this because duck-typing is usually better. But this can provide you with a way to use isinstance with futures. Works with other objects too. :param instance: :param A_tuple: :return: """ try: instance = in... |
def _json_default_encoder(func): """ Monkey-Patch the core json encoder library. This isn't as bad as it sounds. We override the default method so that if an object falls through and can't be encoded normally, we see if it is a Future object and return the result to be encoded. I set a special attribute on the Future o... |
o): try: return o._redpipe_future_result # noqa except AttributeError: pass return func(self, o) return inner |
def suspendJustTabProviders(installation): """ Replace INavigableElements with facades that indicate their suspension. """ if installation.suspended: raise RuntimeError("Installation already suspended") powerups = list(installation.allPowerups) for p in powerups: if INavigableElement.providedBy(p): p.store.powerDown(p,... |
def unsuspendTabProviders(installation): """ Remove suspension facades and replace them with their originals. """ if not installation.suspended: raise RuntimeError("Installation not suspended") powerups = list(installation.allPowerups) allSNEs = list(powerups[0].store.powerupsFor(ISuspender)) for p in powerups: for sne... |
def rows(self): """Returns a numpy array of the rows name""" bf = self.copy() result = bf.query.executeQuery(format="soa") return result["_rowName"] |
def shape(self): """ Returns (rowCount, valueCount) """ bf = self.copy() content = requests.get(bf.dataset_url).json() rowCount = content['status']['rowCount'] valueCount = content['status']['valueCount'] return (rowCount, valueCount) |
def _comparison(self, value, operator): """ Parameters ---------- value: Column object or base type The value against which to compare the column. It can either be another column or a base type value (e.g. int) Returns ------- self.query Notes ----- Returning self.query will allow the next object to use this column ops... |
def _binary_arithemtic(self, left, binary, right): """ Parameters ---------- operand: Column object, integer or float Value on which to apply operator to this column binary: char binary arithmetic operator (-, +, *, /, ^, %) Returns ------- self Notes ----- Returning self will allow the next object to use this column o... |
"pow({},{})".format(left, right) else: copy.execution_name = "{}{}{}".format(left, binary, right) copy.query.addSELECT(copy.execution_name) return copy |
def _unary_arithmetic(self, unary): """ Parameters ---------- unary: char Unary arithmetic operator (-, +) to be applied to this column Returns ------- self Notes ----- Returning self will allow the next object to use this column ops and concatenate something else """ copy = self.copy() copy.query.removeSELECT("{}".for... |
def head(self, n=5): """Returns first n rows""" col = self.copy() col.query.setLIMIT(n) return col.toPandas() |
def write_tsv(output_stream, *tup, **kwargs): """ Write argument list in `tup` out as a tab-separeated row to the stream. """ encoding = kwargs.get('encoding') or 'utf-8' value = '\t'.join([s for s in tup]) + '\n' output_stream.write(value.encode(encoding)) |
def iter_tsv(input_stream, cols=None, encoding='utf-8'): """ If a tuple is given in cols, use the elements as names to construct a namedtuple. Columns can be marked as ignored by using ``X`` or ``0`` as column name. Example (ignore the first four columns of a five column TSV): :: def run(self): with self.input().open()... |
def is_authenticode_signed(filename): """Returns True if the file is signed with authenticode""" with open(filename, 'rb') as fp: fp.seek(0) magic = fp.read(2) if magic != b'MZ': return False # First grab the pointer to the coff_header, which is at offset 60 fp.seek(60) coff_header_offset = struct.unpack('<L', fp.read(... |
just in case return False cert_table_offset = number_of_data_dirs_offset + 4*8 + 4 fp.seek(cert_table_offset) addr, size = struct.unpack('<LL', fp.read(8)) if not addr or not size: return False # Check that addr is inside the file fp.seek(addr) if fp.tell() != addr: return False cert = fp.read(size) if len(cert) != siz... |
def parse_cmdln_opts(parser, cmdln_args): """Rather than have this all clutter main(), let's split this out. Clean arch decision: rather than parsing sys.argv directly, pass sys.argv[1:] to this function (or any iterable for testing.) """ parser.set_defaults( hosts=[], cert=None, log_level=logging.INFO, output_dir=None... |
parser.add_option("-q", "--quiet", dest="log_level", action="store_const", const=logging.WARN) parser.add_option( "-v", "--verbose", dest="log_level", action="store_const", const=logging.DEBUG) parser.add_option("-i", "--include", dest="includes", action="append", help="add to include patterns") parser.add_option("-x",... |
"," in fmt: for fmt in fmt.split(","): if fmt not in ALLOWED_FORMATS: parser.error("invalid format: %s" % fmt) formats.append(fmt) elif fmt not in ALLOWED_FORMATS: parser.error("invalid format: %s" % fmt) else: formats.append(fmt) # bug 1382882, 1164456 # Widevine and GPG signing must happen last because they will be i... |
for h in options.hosts: # The last two parts of a host is the actual hostname:port. Any parts # before that are formats - there could be 0..n formats so this is # tricky to split. parts = h.split(":") h = parts[-2:] fmts = parts[:-2] # If no formats are specified, the host is assumed to support all of them. if not fmts... |
def _getCampaignDict(): """Returns a dictionary specifying the details of all campaigns.""" global _campaign_dict_cache if _campaign_dict_cache is None: # All pointing parameters and dates are stored in a JSON file fn = os.path.join(PACKAGEDIR, "data", "k2-campaign-parameters.json") _campaign_dict_cache = json.load(ope... |
def getFieldInfo(fieldnum): """Returns a dictionary containing the metadata of a K2 Campaign field. Raises a ValueError if the field number is unknown. Parameters ---------- fieldnum : int Campaign field number (e.g. 0, 1, 2, ...) Returns ------- field : dict The dictionary contains the keys 'ra', 'dec', 'roll' (floats... |
def getKeplerFov(fieldnum): """Returns a `fov.KeplerFov` object for a given campaign. Parameters ---------- fieldnum : int K2 Campaign number. Returns ------- fovobj : `fov.KeplerFov` object Details the footprint of the requested K2 campaign. """ info = getFieldInfo(fieldnum) ra, dec, scRoll = info["ra"], info["dec"], ... |
10, 11, 12]) # Hack: the Kepler field is defined as "Campaign 1000" # and (initially) had no broken channels if fieldnum == 1000: brokenChannels = [] return fov.KeplerFov(ra, dec, fovRoll, brokenChannels=brokenChannels) |
def indexer_receiver(sender, json=None, record=None, index=None, **dummy_kwargs): """Connect to before_record_index signal to transform record for ES.""" if index and index.startswith('grants-'): # Generate suggest field suggestions = [ json.get('code'), json.get('acronym'), json.get('title') ] json['suggest'] = { 'inp... |
def get_calendar(self, **kwargs): """Obtain EMT calendar for a range of dates. Args: start_day (int): Starting day of the month in format DD. The number is automatically padded if it only has one digit. start_month (int): Starting month number in format MM. The number is automatically padded if it only has one digit. s... |
util.date_string( kwargs.get('start_day', '01'), kwargs.get('start_month', '01'), kwargs.get('start_year', '1970') ) end_date = util.date_string( kwargs.get('end_day', '01'), kwargs.get('end_month', '01'), kwargs.get('end_year', '1970') ) params = {'SelectDateBegin': start_date, 'SelectDateEnd': end_date} # Request res... |
def get_nodes_lines(self, **kwargs): """Obtain stop IDs, coordinates and line information. Args: nodes (list[int] | int): nodes to query, may be empty to get all nodes. Returns: Status boolean and parsed response (list[NodeLinesItem]), or message string in case of error. """ # Endpoint parameters params = {'Nodes': uti... |
def beforeRender(self, ctx): """ Before rendering, retrieve the hostname from the request being responded to and generate an URL which will serve as the root for all JavaScript modules to be loaded. """ request = IRequest(ctx) root = self.webSite.rootURL(request) self._moduleRoot = root.child('__jsmodule__') |
def getJSModuleURL(self, moduleName): """ Retrieve an L{URL} object which references the given module name. This makes a 'best effort' guess as to an fully qualified HTTPS URL based on the hostname provided during rendering and the configuration of the site. This is to avoid unnecessary duplicate retrieval of the same ... |
def produceResource(self, request, segments, webViewer): """ Return a C{(resource, subsegments)} tuple or None, depending on whether I wish to return an L{IResource} provider for the given set of segments or not. """ def thunk(): cr = getattr(self, 'createResource', None) if cr is not None: return cr() else: return sel... |
def _produceIt(self, segments, thunk): """ Underlying implmeentation of L{PrefixURLMixin.produceResource} and L{PrefixURLMixin.sessionlessProduceResource}. @param segments: the URL segments to dispatch. @param thunk: a 0-argument callable which returns an L{IResource} provider, or None. @return: a 2-tuple of C{(resourc... |
def installSite(self): """ Not using the dependency system for this class because it's only installed via the command line, and multiple instances can be installed. """ for iface, priority in self.__getPowerupInterfaces__([]): self.store.powerUp(self, iface, priority) |
def makeStylesheetResource(self, path, registry): """ Return a resource for the css at the given path with its urls rewritten based on self.rootURL. """ return StylesheetRewritingResourceWrapper( File(path), self.installedOfferingNames, self.rootURL) |
def renderHTTP(self, context): """ Render C{self.resource} through a L{StylesheetRewritingRequestWrapper}. """ request = IRequest(context) request = StylesheetRewritingRequestWrapper( request, self.installedOfferingNames, self.rootURL) context.remember(request, IRequest) return self.resource.renderHTTP(context) |
def _replace(self, url): """ Change URLs with absolute paths so they are rooted at the correct location. """ segments = url.split('/') if segments[0] == '': root = self.rootURL(self.request) if segments[1] == 'Mantissa': root = root.child('static').child('mantissa-base') segments = segments[2:] elif segments[1] in self... |
def finish(self): """ Parse the buffered response body, rewrite its URLs, write the result to the wrapped request, and finish the wrapped request. """ stylesheet = ''.join(self._buffer) parser = CSSParser() css = parser.parseString(stylesheet) replaceUrls(css, self._replace) self.request.write(css.cssText) return self.... |
def cleartextRoot(self, hostname=None): """ Return a string representing the HTTP URL which is at the root of this site. @param hostname: An optional unicode string which, if specified, will be used as the hostname in the resulting URL, regardless of the C{hostname} attribute of this item. """ warnings.warn( "Use ISite... |
def rootURL(self, request): """ Simple utility function to provide a root URL for this website which is appropriate to use in links generated in response to the given request. @type request: L{twisted.web.http.Request} @param request: The request which is being responded to. @rtype: L{URL} @return: The location at whic... |
def rootChild_resetPassword(self, req, webViewer): """ Redirect authenticated users to their settings page (hopefully they have one) when they try to reset their password. This is the wrong way for this functionality to be implemented. See #2524. """ from xmantissa.ixmantissa import IWebTranslator, IPreferenceAggregato... |
def getKeyForAPI(cls, siteStore, apiName): """ Get the API key for the named API, if one exists. @param siteStore: The site store. @type siteStore: L{axiom.store.Store} @param apiName: The name of the API. @type apiName: C{unicode} (L{APIKey} constant) @rtype: L{APIKey} or C{NoneType} """ return siteStore.findUnique( c... |
def setKeyForAPI(cls, siteStore, apiName, apiKey): """ Set the API key for the named API, overwriting any existing key. @param siteStore: The site store to install the key in. @type siteStore: L{axiom.store.Store} @param apiName: The name of the API. @type apiName: C{unicode} (L{APIKey} constant) @param apiKey: The key... |
def rootURL(self, request): """ Return the URL for the root of this website which is appropriate to use in links generated in response to the given request. @type request: L{twisted.web.http.Request} @param request: The request which is being responded to. @rtype: L{URL} @return: The location at which the root of the r... |
def getFactory(self): """ Create an L{AxiomSite} which supports authenticated and anonymous access. """ checkers = [self.loginSystem, AllowAnonymousAccess()] guardedRoot = PersistentSessionWrapper( self.store, Portal(self.loginSystem, checkers), domains=[self.hostname]) unguardedRoot = UnguardedWrapper(self.store, guar... |
def child_static(self, context): """ Serve a container page for static content for Mantissa and other offerings. """ offeringTech = IOfferingTechnician(self.siteStore) installedOfferings = offeringTech.getInstalledOfferings() offeringsWithContent = dict([ (offering.name, offering.staticContentPath) for offering in inst... |
def locateChild(self, context, segments): """ Return a statically defined child or a child defined by a sessionless site root plugin or an avatar from guard. """ shortcut = getattr(self, 'child_' + segments[0], None) if shortcut: res = shortcut(context) if res is not None: return res, segments[1:] req = IRequest(contex... |
def locateChild(self, context, segments): """ Unwrap the wrapped resource if HTTPS is already being used, otherwise wrap it in a helper which will preserve the wrapping all the way down to the final resource. """ request = IRequest(context) if request.isSecure(): return self.wrappedResource, segments return _SecureWrap... |
def renderHTTP(self, context): """ Render the wrapped resource if HTTPS is already being used, otherwise invoke a helper which may generate a redirect. """ request = IRequest(context) if request.isSecure(): renderer = self.wrappedResource else: renderer = _SecureWrapper(self.urlGenerator, self.wrappedResource) return r... |
def locateChild(self, context, segments): """ Delegate child lookup to the wrapped resource but wrap whatever results in another instance of this wrapper. """ childDeferred = maybeDeferred( self.wrappedResource.locateChild, context, segments) def childLocated((resource, segments)): if (resource, segments) == NotFound: ... |
def renderHTTP(self, context): """ Check to see if the wrapped resource wants to be rendered over HTTPS and generate a redirect if this is so, if HTTPS is available, and if the request is not already over HTTPS. """ if getattr(self.wrappedResource, 'needsSecure', False): request = IRequest(context) url = self.urlGenera... |
def locateChild(self, context, segments): """ Find the offering with the name matching the first segment and return a L{File} for its I{staticContentPath}. """ name = segments[0] try: staticContent = self.staticPaths[name] except KeyError: return NotFound else: resource = File(staticContent.path) resource.processors = ... |
def handle_single_request(self, request_object): """ Handles a single request object and returns the raw response :param request_object: """ if not isinstance(request_object, (MethodCall, Notification)): raise TypeError("Invalid type for request_object") method_name = request_object.method_name params = request_object.... |
def call_method(self, method_name_or_object, params=None): """ Calls the ``method_name`` method from the given service and returns a :py:class:`gemstone.client.structs.Result` instance. :param method_name_or_object: The name of te called method or a ``MethodCall`` instance :param params: A list of dict representing the... |
def call_method_async(self, method_name_or_object, params=None): """ Calls the ``method_name`` method from the given service asynchronously and returns a :py:class:`gemstone.client.structs.AsyncMethodCall` instance. :param method_name_or_object: The name of te called method or a ``MethodCall`` instance :param params: A... |
def notify(self, method_name_or_object, params=None): """ Sends a notification to the service by calling the ``method_name`` method with the ``params`` parameters. Does not wait for a response, even if the response triggers an error. :param method_name_or_object: the name of the method to be called or a ``Notification`... |
def handle_single_request(self, request_object): """ Handles a single request object and returns the correct result as follows: - A valid response object if it is a regular request (with ID) - ``None`` if it was a notification (if None is returned, a response object with "received" body was already sent to the client. ... |
self.call_method_from_all_plugins("on_method_call", request_object) else: self.call_method_from_all_plugins("on_method_call", request_object) if self._method_is_private(method): if not self.get_current_user(): resp = GenericResponse.ACCESS_DENIED resp.id = id_ return resp method = self.prepare_method_call(method, reque... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.