Python
  Home arrow Python arrow Page 4 - Karrigell for Python
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PYTHON

Karrigell for Python
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 13
    2006-01-03


    Table of Contents:
  • Karrigell for Python
  • Scripts and Services
  • Being HIP
  • A Few More Features

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Karrigell for Python - A Few More Features
    ( Page 4 of 4 )

    Although I'm not a huge fan of the practice, tags can be generated within Python scripts, as shown here in tagTest.py:

    from HTMLTags import *

    print CENTER ( B ( "Test." ) )

    Sessions are also possible with Karrigell, and Karrigell presents a nice, object-oriented approach to sessions. Let's create a simple script that demonstrates sessions in Karrigell. Upon accessing the script for the first time, the user will receive a “lucky number” of sorts. If the user refreshes, the same number will still appear since it will be stored inside of a session. However, the user will be given the option of resetting his or her lucky number by closing the session. Create a Karrigell service named luckyNumber.ks in which to house this script:

    import random

    user = Session()

    def index():
       if not "luckyNumber" in dir ( user ):
          user.luckyNumber = random.randint ( 0, 20 )
       print "Your lucky number:", user.luckyNumber
       print "<br /><br />"
       print "<a href='reset'>Reset Lucky Number</a>"
    def reset():
       user.close()
       print "Your lucky number has been reset."
       print "<br /><br />"
       print "<a href='index'>Back</a>"

    Conclusion

    Karrigell offers four methods of web development using Python: Python scripts, Karrigell services, HTML Inside Python and Python Inside HTML. Each method is unique and has its benefits, but they all share one thing in common: each method is very simple to employ in applications. Karrigell approaches web development in a straightforward manner, presenting simple solutions to a simple problem. Even installing Karrigell and configuring Apache and Karrigell to interact is a surprisingly simple process. Because of all this, Karrigell appeals to both newcomers and experts in Python alike.



     
     
    >>> More Python Articles          >>> More By Peyton McCullough
     

       

    PYTHON ARTICLES

    - Tuples and Other Python Object Types
    - The Dictionary Python Object Type
    - String and List Python Object Types
    - Introducing Python Object Types
    - Mobile Programming using PyS60: Advanced UI ...
    - Nested Functions in Python
    - Python Parameters, Functions and Arguments
    - Python Statements and Functions
    - Statements and Iterators in Python
    - Sequences and Sets in Python
    - Python Expressions and Operators
    - Dictionaries, Variables and Statements in Py...
    - Data Types in Python
    - The Python Language
    - SSH with Twisted





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek