Giter VIP home page Giter VIP logo

armstrong.utils.backends's Introduction

armstrong.utils.backends

Generic backend system to use throughout Armstrong

Warning

This is development level software. Please do not unless you are familiar with what that means and are comfortable using that type of software.

Usage

You can use this to handle loading one or more "backends" that need to be configured at runtime. To create a new backend object, you would do something like this in your __init__.py:

backends = GenericBackend("MY_BACKEND_KEY")

MY_BACKEND_KEY is the name of the key that the end user sets in their settings.py file. The end-user should set it to either a string or a list.

You can also provide a default backend (or backends) by setting the defaults kwarg for GenericBackend:

default_backends = ["myapp.backends.TwitterBackend",
                    "myapp.backends.FacebookBackend", ]
backends = GenericBackend("MY_BACKEND_KEY", defaults=default_backends)

When you're ready to use the backends, you can call get_backend to retrieve the backend to use. This is done after instantiation to allow for the value to change depending on the context that it was called in.

Writing Backends

Backends are simple objects that do any particular task. Beyond using get_backend to handle the creation of the backend, you treat it as if you were calling it directly.

All attributes (and methods) accessed on the backend are proxied to handle dispatching to multiple backends.

All backends should return something. If they were unable to process the response they should return armstrong.utils.backends.DID_NOT_HANDLE

Installation

Use pip to install like this:

pip install armstrong.utils.backends

Contributing

  • Create something awesome -- make the code better, add some functionality, whatever (this is the hardest part).
  • Fork it
  • Create a topic branch to house your changes
  • Get all of your commits in the new topic branch
  • Submit a pull request

State of Project

Armstrong is an open-source news platform that is freely available to any organization. It is the result of a collaboration between the Texas Tribune and Bay Citizen, and a grant from the John S. and James L. Knight Foundation. The first release is scheduled for June, 2011.

To follow development, be sure to join the Google Group.

armstrong.utils.backends is part of the Armstrong project. You're probably looking for that.

License

Copyright 2011 Bay Citizen and Texas Tribune

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

armstrong.utils.backends's People

Contributors

tswicegood avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.