Skip to main content

Common utilities used within SPARC platform

Project description

sparc.common

Basic common tools used in the SPARC platform. Includes, but not limited to Zope Component ZCML utilities.

ZCA Configuration

Tools that leverage SPARC packages are usually also dependant on Zope Component Architecture (http://docs.zope.org/zope.component/narr.html). Use of ZCA requires component configuration, which SPARC does via ZCML (https://github.com/zopefoundation/zope.component/blob/master/docs/zcml.rst).

Among other things, sparc.common provides access to Configure(), an easy function that can be used to configure dependant applications.

### Usage - ZCA configuration

This simplifies your ability to create components via ZCML and have your application parse the ZCML files to allow them to be registered for lookup. >>> import a.package.that.contains.a.configure.zcml >>> import another.package.that.contains.a.configure.zcml >>> from sparc.common import Configure >>> Configure([your.package.that.contains.a.configure.zcml, … another.package.that.contains.a.configure.zcml])

You will now have access to components configured within those packages.

### Usage - Retrieve user feedback from CLI application

This simplifies the process of getting feedback for processing within a CLI application. >>> import sparc.common >>> from sparc.common import Configure >>> from sparc.common import ICallable >>> from zope.component import getUtility >>> Configure([sparc.common]) >>> asker = getUtiliy(ICallable, ‘sparc.common.ask_question’) >>> answer = asker(u”How are you?”, required = True, answers = {‘1’:’awesome’,’2’:’ok’,’3’:’not so good’}, tries = 3) How are you? (1) awesome (2) ok (3) not so good

>>> print answer
'1'

Changelog

1.0.0dev (unreleased)

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sparc.common-0.0.1.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file sparc.common-0.0.1.tar.gz.

File metadata

  • Download URL: sparc.common-0.0.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sparc.common-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3f577f561acf9a3499d0068f4829bfc848abb313fe0b56442ee5c4687b09c178
MD5 e0e6e70448e0280a617a2f404d4f34bd
BLAKE2b-256 473ca1ee0f9d606494335d01686338e72d4dec1070b6aecae31dc4b1d74df9b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page