{
"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(\"