sections to help building a window dev environment
.. -*- coding: utf-8 -*-=============LAX Tutorial=============Introduction============LAX stands for Logilab App engine eXtension. It is a web frameworkrunning on top of the Google AppEngine datastore.Distinctive features include a data-model driven engine, a querylanguage, a selection/view mechanism for HTML/XML/text generation,reuseable components, etc. It all sums up to very fast and efficientdevelopment.This tutorial will guide you to build a blog application step by stepto discover the unique features of LAX. It assumes that you followedthe installation guidelines and that both the AppEngine SDK and theLAX framework are setup on your computer.Creating a very simple application==================================Creating a new application--------------------------When you installed lax, you saw a directory named skel. Make a copy ofthis directory and call it BlogDemo.Defining a schema-----------------With LAX, the schema/datamodel is the core of the application.Let us start with something simple and improve on it later. First, wemake sure that in appconfig.py we have a line :: schema_type = 'yams'Then, in schema.py, we define two entities : ``Blog`` and ``BlogEntry``.:: class Blog(EntityType): title = String(maxsize=50, required=True) description = String() class BlogEntry(EntityType): title = String(maxsize=100, required=True) publish_date = Date(default='TODAY') text = String(fulltextindexed=True) category = String(vocabulary=('important','business')) entry_of = SubjectRelation('Blog', cardinality='?*')A Blog has a title and a description. The title is a string that isrequired and must be less than 50 characters. The description is astring that is not constrained.A BlogEntry has a title, a publish_date and a text. The title is astring that is required and must be less than 100 characters. Thepublish_date is a Date with a default value of TODAY, meaning thatwhen a BlogEntry is created, its publish_date will be the current dayunless it is modified. The text is a string that will be indexed inthe full-text index and has no constraint.A BlogEntry also has a relationship ``entry_of`` that link it to aBlog. The cardinality ``?*`` means that a BlogEntry can be part ofzero or one Blog (``?`` means `zero or one`) and that a Blog canhave any number of BlogEntry (``*`` means `any number includingzero`). For completeness, remember that ``+`` means `one or more`.:note: in lax-0.3.0, cardinality checking is not fully ported toAppEngine, so cardinality limits are not enforced. This should befixed in lax-0.4.0 available at the beginning of June.Using the application---------------------Defining this simple schema is enough to get us started. Launch theapplication with the command:: python dev_appserver.py BlogDemoand point your browser at localhost:8080You will see the home page of your application. It lists the entitytypes: Blog and BlogEntry.Let us create a few of these. Click on the [+] at the right of thelink Blog. Call this new Blog ``Tech-blog`` and type in``everything about technology`` as the description, then validate theform by clicking on ``button_ok``.Click on the logo at top left to get back to the home page, thenfollow the Blog link. If this link reads ``blog_plural`` it is becausei18n is not working for you yet. Let us ignore this for a while. Afterfollowing the link, you should be seeing a list with a single item``Tech-blog``. Clicking on this item will get you to its detaileddescription except that in this case, there is not much to displaybesides the name and the phrase ``everything about technology``.Now get back to the home page by clicking on the top-left logo, thencreate a new Blog called ``MyLife`` and get back to the home pageagain to follow the Blog link for the second time. The list nowhas two items.Get back to the home page and click on [+] at the right of the linkBlogEntry. Call this new entry ``Hello World`` and type in some textbefore clicking on ``button_ok``. You added a new blog entry withoutsaying to what blog it belongs. There is a box on the left entitled``actions``, click on the menu item ``modify``. You are back to the formto edit the blog entry you just created, except that the form now hasanother section with a combobox titled ``add relation``. Chose``entry_of`` in this menu and a second combobox appears where you pick``MyLife``. Validate the changes by clicking``button_ok``. The entity BlogEntry that is displayed now includes a linkto the entity Blog named ``MyLife``.Conclusion----------Exercise~~~~~~~~Create new blog entries in ``Tech-blog``.What we learned~~~~~~~~~~~~~~~Creating a simple schema was enough to set up a new application thatcan store blogs and blog entries. What is next ?--------------Althought the application is fully functionnal, its look is verybasic. We will now improve how information is displayed by writingviews.Developing the user interface with Views========================================[WRITE ME]* Defining views with selection/views* implementing interfaces, calendar for blog entries.* show that a calendar view can export data to ical. * create view "blogentry table" with title, publish_date, category.* in view blog, select blogentries and apply view "blogentry table"* demo ajax by filtering blogentry table on categoryComponents===========[WRITE ME]* explain the component architecture* add comments to the blog by importing the comments componentBoxes======[WRITE ME]* explain how to build a box* add an blogentry archives boxPreferences============[WRITE ME]* talk about the user preferences* add an example on how to hide / display / move a component or a boxMainTemplate============[WRITE ME]* customize MainTemplate and show that everything in the user interface can be changedRSS Channel===========[WRITE ME]* show that the RSS view can be used to display an ordered selection of blog entries, thus providing a RSS channel* show that a different selection (by category) means a different channelRQL====[WRITE ME]* talk about the Relation Query LanguageURL Rewriting=============[WRITE ME]* show how urls are mapped to selections and views and explain URLRewriting Security=========[WRITE ME]* talk about security access rights and show that security is defined using RQL