{ "info": { "author": "mike cullerton", "author_email": "michaelc@cullerton.com", "bugtrack_url": null, "classifiers": [], "description": "=====\nAgora\n=====\n\nAgora is a forum for ideas. It is a simple, blog-like application, with support for multiple authors.\n\nIt is developed for a class curriculum, and is not intended for real deployment, although it could serve some purpose.\n\nThere are two classes--Author and Idea. A forum can have zero or more authors. Each author can have zero or more ideas.\n\nAgora uses SQLAlchemy for a persistence layer. You need a valid SQLAlchemy session to initialize agora.\n\n-----\nUsage\n-----\n\nSet up SQLAlchemy session\n-------------------------\n\n::\n\n >>> from agora.models import Base\n\n >>> from sqlalchemy import create_engine\n >>> from sqlalchemy.orm import scoped_session, sessionmaker\n\n >>> engine = create_engine('sqlite:///:memory:')\n >>> Base.metadata.create_all(engine)\n\n >>> DBSession = scoped_session(sessionmaker())\n >>> DBSession.configure(bind=engine)\n\nForum Basics\n------------\n\n::\n\n >>> from agora import Forum\n >>> forum = Forum(DBSession)\n\nA new forum has no authors or ideas.\n\n::\n\n >>> forum.get_authors()\n []\n >>> forum.get_ideas()\n []\n\nTo add an idea, you first need an author.\n\nTo add a new author, pass a username, fullname, and email to the `add_author` method.\n\n::\n\n >>> forum.add_author(username='schmoe', fullname='Joe Schmoe', email='schmoe@example.com')\n 1\n >>> forum.add_author(username='misinformation', fullname='Miss Information', email='misinformation@example.com')\n 2\n\nNotice that the method returns the author's id.\n\n\nWe now have authors.\n\n::\n\n >>> forum.get_authors()\n [Joe Schmoe, March 02, 2016, Miss Information, March 02, 2016]\n\nYou can access authors by id.\n\n::\n\n >>> forum.get_author(1)\n Joe Schmoe, March 02, 2016\n\nTo add a new idea, pass a title, idea, and author_id to the `add_idea` method.\n\n::\n\n >>> forum.add_idea(title='First Idea!', idea='This is my idea.', author_id=1)\n 1\n\n >>> forum.add_idea(title='My First Idea!', idea='This is my idea.', author_id=2)\n 2\n\n >>> forum.add_idea(title='Another Idea!', idea='This is my idea.', author_id=1)\n 3\n\n >>> forum.add_idea(title='Another Idea!', idea='This is my idea.', author_id=2)\n 4\n\nWe now have ideas.\n\n::\n\n >>> forum.get_ideas()\n [First Idea!, Joe Schmoe, March 02, 2016, My First Idea!, Miss Information, March 02, 2016, Another Idea!, Joe Schmoe, March 02, 2016, Another Idea!, Miss Information, March 02, 2016]\n\nYou can access ideas by id.\n\n::\n\n >>> forum.get_idea(1)\n First Idea!, Joe Schmoe, March 02, 2016\n\nYou can also access ideas with filters.\n\n::\n\n >>> forum.get_ideas(filters={'author': forum.get_author(1)})\n [First Idea!, Joe Schmoe, March 02, 2016, Another Idea!, Joe Schmoe, March 02, 2016]\n\n >>> forum.get_ideas(filters={'title': 'First Idea!'})\n [First Idea!, Joe Schmoe, March 02, 2016]\n\n >>> forum.get_ideas(filters={'title': 'Another Idea!'})\n [Another Idea!, Joe Schmoe, March 02, 2016, Another Idea!, Miss Information, March 02, 2016]\n\n >>> forum.get_ideas(filters={'author': forum.get_author(2), 'title': 'Another Idea!'})\n [Another Idea!, Miss Information, March 02, 2016]\n\nYou can delete ideas by id.\n\n::\n\n >>> forum.delete_idea(1)\n 1\n\n >>> forum.get_ideas()\n [My First Idea!, Miss Information, March 02, 2016, Another Idea!, Joe Schmoe, March 02, 2016, Another Idea!, Miss Information, March 02, 2016]\n\n-------------------\nInitialize Database\n-------------------\n\nThere is a script provided to initialize the database. It is installed into the bin directory of your virtualenv. You must pass it a valid SQLAlchemy database URI.\n\n::\n\n $ initialize_agora_db \n\n $ initialize_agora_db sqlite:///agora.sqlite\n\n\nYou can also use the script to seed the database with a sample author and two ideas, if you append the word `seed` to the command.\n\n::\n\n $ initialize_agora_db sqlite:///agora.sqlite seed\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/cullerton/cullerton.agora/tarball/0.0.2", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cullerton/cullerton.agora", "keywords": "academic,simple,example", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "cullerton.agora", "package_url": "https://pypi.org/project/cullerton.agora/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/cullerton.agora/", "project_urls": { "Download": "https://github.com/cullerton/cullerton.agora/tarball/0.0.2", "Homepage": "https://github.com/cullerton/cullerton.agora" }, "release_url": "https://pypi.org/project/cullerton.agora/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "A forum for ideas", "version": "0.0.2" }, "last_serial": 1991080, "releases": { "0.0.1": [], "0.0.2": [ { "comment_text": "", "digests": { "md5": "9c442debb7335d2b3014ca3eeff32b54", "sha256": "b1305b62359bb955828fe025535aa6241a809145752e0ba1cabe99d770dcff03" }, "downloads": -1, "filename": "cullerton.agora-0.0.2.tar.gz", "has_sig": false, "md5_digest": "9c442debb7335d2b3014ca3eeff32b54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6811, "upload_time": "2016-03-05T16:49:34", "url": "https://files.pythonhosted.org/packages/c8/37/224a156f70503b658f2bdf421f58642902158c9a06a84920b6bdf8580a02/cullerton.agora-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9c442debb7335d2b3014ca3eeff32b54", "sha256": "b1305b62359bb955828fe025535aa6241a809145752e0ba1cabe99d770dcff03" }, "downloads": -1, "filename": "cullerton.agora-0.0.2.tar.gz", "has_sig": false, "md5_digest": "9c442debb7335d2b3014ca3eeff32b54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6811, "upload_time": "2016-03-05T16:49:34", "url": "https://files.pythonhosted.org/packages/c8/37/224a156f70503b658f2bdf421f58642902158c9a06a84920b6bdf8580a02/cullerton.agora-0.0.2.tar.gz" } ] }