{ "info": { "author": "Sergio A. Hernandez", "author_email": "hernandez.sergio.a@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "===========\n S-HTML\n===========\n\nS-HTML is a simple and easy to use HTML OOP Web Framework to use with WSGI\n\n==================================\n1.- Install Mod_WSGI for Python 3:\n==================================\nin Debian like systems type:\n\tapt-get install libapache2-mod-wsgi-py3\n\n==============================\n2.- Configure the virtual host\n==============================\nChanges to the DEFAULT file\nThe file /etc/apache2/sites-available/default needs to be modified:\n\n\tDocumentRoot /var/www/public_name\n\tWSGIScriptAlias /public_name /var/www/path_to_application/application.wsgi\n\nYour folder structure should look like the following scheme:\n\t/var/www/\n\t\u251c\u2500\u2500 path_to_application/\n\t\u2502\t\u251c\u2500\u2500 application.wsgi\n\t\u2502\t\u2514\u2500\u2500 python_modules/\n\t\u2514\u2500\u2500 public_name/\n\t\t\u251c\u2500\u2500 css/\n\t\t\u251c\u2500\u2500 js/\n\t\t\u251c\u2500\u2500 images/\n\t\t\u2514\u2500\u2500 other_fix_content/\n\nRestart the Apache server:\n\tservice apache2 restart\n\n====================================\n3.- Create the application.wsgi file\n====================================\nUse the following demo to test the S-HTML capabilities:\n\n# -*- coding: utf-8 *-*\nimport os, sys, Pi_html\n\ndef application(environ, start_response):\n request = environ['REQUEST_URI']\n if not request.find(\"?\") == -1:\n (url_path, query_string) = request.split(\"?\")\n else:\n url_path = request\n query_string = \"\" \n if url_path == \"/path_to_application/debug\":\n if environ['REQUEST_METHOD'] == 'GET':\n get = S_html.fetchQueryString(query_string.split(\"&\"))\n result = \"GET :
Array
{
\"\n for key in get.keys():\n result += \" \" * 4 + \"[{}]\".format(key) + \" => \" + get[key] + \"
\"\n result += \"}\"\n if environ['REQUEST_METHOD'] == 'POST':\n post = S_html.fetchPost(environ['wsgi.input'])\n result = \"POST :
Array
{
\"\n for key in post.keys():\n result += \" \" * 4 + \"[{}]\".format(key) + \" => \" + post[key] + \"
\"\n result += \"}\"\n elif url_path == \"/pi_html\":\n page = S_html.Pi_html(\"Pi_HTML Class Demo\")\n page.add_pageTabs([[\"Index\", \"index\", True],\n\t\t [\"Edit\", \"edit\", False],\n\t\t [\"New\", \"new\", False]])\n page.add_bodyContent(page.tag(\"h2\", \"\", request))\n\n frmDemo = S_html.Form(\"frmDemo\", \"/path_to_application/debug\", \"post\", \"Submit\")\n frmDemo.add_item(\"Text\", \"text\", \"Some Value\", \"text\", \"required\")\n frmDemo.add_item(\"Password\", \"password\", \"Some Value\", \"password\", \"\")\n frmDemo.add_item(\"Date\", \"date\", \"2013-12-12\", \"date\", \"\")\n frmDemo.add_item(\"Number\", \"number\", \"80\", \"number\", \"min='0' max='100'step='1'required\")\n frmDemo.add_item(\"Textarea\", \"textarea\", \"Some Value\", \"textarea\", \"\")\n frmDemo.add_item(\"File\", \"file\", \"\", \"file\", \"\")\n frmDemo.add_item(\"Picture\", \"picture\", \"\", \"picture\", \"\")\n frmDemo.add_item(\"Checkbox\", \"checkbox\", \"\", \"checkbox\", \"\")\n frmDemo.add_item(\"Hidden\", \"hidden\", \"Hidden value\", \"hidden\", \"\")\n options = frmDemo.select_options([[1, \"First\"],\n [2, \"Second\"],\n [3, \"Selected\"],\n [4, \"Other...\"]], 3)\n frmDemo.add_item(\"Select\", \"select\", options, \"select\", \"\")\n \n fldset= S_html.Fieldset(\"Fieldset\", frmDemo.showHTML())\n page.add_bodyContent(fldset.showHTML())\n\n tableDemo = S_html.Table(\"Table Demo\", \"regularTable\")\n tableDemo.add_header([\"Column 1\", \"Column 2\", \"Column 3\", \"Column 4\"])\n tableDemo.add_row([\"Content 1\", \"Content 2\", \"Content 3\", \"Content 4\"])\n tableDemo.add_row([\"Content 5\", \"Content 6\", \"Content 7\", \"Content 8\"])\n tableDemo.add_row([\"Content 9\", \"Content 10\", \"Content 11\", \"Content 12\"])\n tableDemo.add_footer(\"Some footer information\")\n page.add_bodyContent(tableDemo.showHTML())\n\n fldset2= S_html.Fieldset(\"Fieldset\", tableDemo.showHTML())\n page.add_bodyContent(fldset2.showHTML())\n\n start_response('200 OK', [('Content-Type', 'text/html; charset=utf-8')])\n result = page.showHTML()\n else:\n result = \"Not Found\"\n \n start_response('200 OK', [('Content-Type', 'text/html; charset=utf-8')])\n return result\n\n================================\n4.- Create the pi_html.css file:\n================================\nUse the example included or create your own\n\n==========================\n5.- POST and GET functions\n==========================\nDepending in what method are you passing your form data you can use the following functions to retrieve the fields content into a List:\n\tget = S_html.fetchQueryString(query_string.split(\"&\"))\n\tpost = S_html.fetchPost(environ['wsgi.input'])\n\nYou can access the fields content:\n\tget['get_field_name']\nor\n\tpost['post_field_name']\n\t\n===============\n6.- Have fun!!!\n===============\nBased on the demo use the trial and error process, and have fun!", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://ingelinux.wordpress.com/about/", "keywords": null, "license": "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version", "maintainer": null, "maintainer_email": null, "name": "S_html", "package_url": "https://pypi.org/project/S_html/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/S_html/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://ingelinux.wordpress.com/about/" }, "release_url": "https://pypi.org/project/S_html/1.0.3/", "requires_dist": null, "requires_python": null, "summary": "A simple and easy to use HTML OOP Web Framework to use with WSGI", "version": "1.0.3" }, "last_serial": 954667, "releases": { "1.0.3": [ { "comment_text": "", "digests": { "md5": "66e4dd3226ddc988860a182eb469ad9e", "sha256": "2bc0e77c214873c55a61f0ca270ac59d3b66b179d7e0522065fc1fcb0bb015ec" }, "downloads": -1, "filename": "S_html-1.0.3.tar.gz", "has_sig": false, "md5_digest": "66e4dd3226ddc988860a182eb469ad9e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5688, "upload_time": "2013-12-25T19:38:06", "url": "https://files.pythonhosted.org/packages/38/7c/61b1b2ffce56325c407d202a11ac53a7bfd8bc79de49f401fb307306f13f/S_html-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "66e4dd3226ddc988860a182eb469ad9e", "sha256": "2bc0e77c214873c55a61f0ca270ac59d3b66b179d7e0522065fc1fcb0bb015ec" }, "downloads": -1, "filename": "S_html-1.0.3.tar.gz", "has_sig": false, "md5_digest": "66e4dd3226ddc988860a182eb469ad9e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5688, "upload_time": "2013-12-25T19:38:06", "url": "https://files.pythonhosted.org/packages/38/7c/61b1b2ffce56325c407d202a11ac53a7bfd8bc79de49f401fb307306f13f/S_html-1.0.3.tar.gz" } ] }