Hi all,<br><br>I'm working on a web application framework in Python, and just uploaded the first release. <br><br>Now I quote from my own README. What it actually does is:<br><br><div style="margin-left: 80px;">- Provide an easy way to embed Python code into HTML, similar to PHP, JPS and<br>
other server side languages.<br>- Make reusing HTML very easy. It uses concepts like master pages and<br> including of other pages as a control. This is a very rich template<br> mechanism.<br>- when pages act like web controls for other pages, they are simply available as<br>
a member variable of the other pages.<br>- It contains a built-in HTTP/1.1 web server but also supports CGI.<br>- Uses clean URLs. There are no .page extensions, and suffixes are available<br> as a variable. For instance, if there's a page /test.page, then the URL<br>
/test/abc will render /test.page, but receive the suffix /abc. This is totally<br> not a new concept, but just very easy to use.<br>- Output filters for post processing of the generated XHTML tree.<br>- URLs will always be relative to the page where they've been generated.<br>
This makes it very easy for included pages to use URLs relative to their<br> own even if their in a totally different directory. (This mechanism<br> requires an output filter.)<br>- The render engine has built-in debug functionality. The current<br>
web based debugger isn't yet ready to use, but the back-end<br> has already been implemented.<br></div><br>The target audience is at the moment mainly for programmers, because the front-end (which I considered less important until now) is uncomplete.<br>
<br>The core has been extensively tested and works pretty well, but some minory features are missing and therefore I consider the whole alpha quality.<br><br>I'm constantly trying to get everything work in IronPython because that's definitely a great bonus. Until now, it doesn't run in IronPython because it executes part of the pages though eval while the globals/locals for these parts are each time passed on the next eval call. (bugs has been submitted on codeplex, see user:jonathanslenders)<br>
<br>It does however work already with Silverlight. A page can dynamically build a xap file with Python code in. Thanks to Harry Pierson for the tip!<br>Because I'm really new to Silverlight and don't know much about it's capabilities, some research needs to be done, to get the best of this integration. -- But the concept works very well.<br>
<br>To give you all an idea of the layout of such pages:<br>One page (a master) may look like this.<br><br><%!page output="xhtml" filters="resolve_uris,highlight_code" %><br><%!content placeholder="Main" %><br>
<html><br> <head><br> <%!placeholder id="head" %><br> </head><br> <body><br> <%!placeholder id="content" %><br> </body><br></html><br>
<br>and another may implement his placeholders. This one does some math. Note the modified python syntax. My compiler compiles these pages to regular python classes.<br><br><%!page master="/Master" external="true" %><br>
<%!content placeholder="head" %><br><title>Hello world page</title><br><%!content placeholder="content" %><br><p><br> Let's count to 10:<br></p><br><ul><br>
<% for i in range(0,10): %><br> <li><%= i %></li><br> <% endfor; %><br></ul><br><%<br>def factorial(i):<br> if i == 0:<br> return 1;<br> else:<br> return i * factorial(i - 1);<br>
endif;<br>enddef;<br>%><br><p><br> The factorial of 10 is <%= factorial(10) %><br></p><br><br>And the Silverlight control:<br><br><%!page master="/controls/silverlight-xap" external="true" %><br>
<%!content name="python" %><br>from System.Windows import Application<br>from System.Windows.Controls import Canvas<br>xaml = Application.Current.LoadRootVisual(Canvas(), "app.xaml")<br>xaml.textblock.Text = 'Hello world from IronPython'<br>
<%!content name="xaml" %><br><Canvas x:Class="System.Windows.Controls.Canvas"<br> xmlns="<a href="http://schemas.microsoft.com/client/2007">http://schemas.microsoft.com/client/2007</a>"<br>
xmlns:x="<a href="http://schemas.microsoft.com/winfx/2006/xaml">http://schemas.microsoft.com/winfx/2006/xaml</a>"<br> x:Name="parentCanvas"><br><TextBlock x:Name="textblock" FontSize="30">Hello world from XAML </TextBlock><br>
</Canvas><br> <br><br>The source code is available here:<br><br><a href="http://code.google.com/p/python-pages/">http://code.google.com/p/python-pages/</a><br><br><br><br>I hope someone thinks this is interesting.<br>
<br><br>Jonathan<br>