3 commits - docs/main README
by Luke Macken
README | 14 ++++----------
docs/main/PluginEntryPoints.rst | 15 +++++++++++++++
2 files changed, 19 insertions(+), 10 deletions(-)
New commits:
commit bbfb7967e9294be6631760c05c5408fb41d22d77
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Dec 21 17:09:35 2010 -0500
Document the moksha.root entry-point
diff --git a/docs/main/PluginEntryPoints.rst b/docs/main/PluginEntryPoints.rst
index 17b2e1b..5a2c7a7 100644
--- a/docs/main/PluginEntryPoints.rst
+++ b/docs/main/PluginEntryPoints.rst
@@ -25,6 +25,21 @@ Entry points are defined in your projects ``setup.py`` like so:
hellowidget = helloworld.widgets:HelloWorldWidget
"""
+Mounting the root controller of your application
+------------------------------------------------
+
+Moksha allows you to easily configure the root controller of your application.
+You can do this by mounting your controller on the ``[moksha.root]``
+entry-point as ``root``, like so:
+
+.. code-block:: python
+
+ [moksha.root]
+ root = myproject.controllers.root:RootController
+
+.. seealso::
+
+ `Writing TurboGears Controllers <http://turbogears.org/2.1/docs/main/Controllers.html>`_
Mounting a TurboGears application
----------------------------------
commit 006cebd07ff27c84cb4dd1bc63463f3af61a47e1
Merge: cbcd2e0... ed226b3...
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Dec 21 16:52:26 2010 -0500
Merge branch 'master' of git+ssh://git.fedorahosted.org/git/moksha
commit cbcd2e05771ff3bd9cac24f37aae1fe40889ab49
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Dec 21 16:48:39 2010 -0500
Minimize the readme
diff --git a/README b/README
index 7bf977d..dc059e4 100644
--- a/README
+++ b/README
@@ -2,15 +2,9 @@
Moksha
======
-http://moksha.csh.rit.edu
+http://mokshaproject.net
-mod_wsgi RPM installation
--------------------------
+Documentation
+-------------
- $ paver reinstall{,_apps} restart_httpd
-
-Local virtualenv install
-------------------------
-
- $ ./start-moksha
- $ ./stop-moksha
+http://mokshaproject.net/apps/docs
13 years, 6 months
7 commits - docs/main docs/_templates moksha/apps website/index.html
by Luke Macken
docs/_templates/indexcontent.html | 49 ++--
docs/main/CSRFProtection.rst | 25 ++
docs/main/GettingStarted.rst | 1
docs/main/MessageBrokers.rst | 31 ++
docs/main/MokshaLabs.rst | 1
docs/main/Security.rst | 28 --
moksha/apps/menus/moksha/apps/menus/default.py | 3
website/index.html | 286 ++++++++++++-------------
8 files changed, 228 insertions(+), 196 deletions(-)
New commits:
commit ed226b34f601e5f4b3f78ccc85f4c33b071fa1ba
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Dec 21 16:52:02 2010 -0500
Various tweaks and improvements to our homepage
diff --git a/website/index.html b/website/index.html
index 52c6055..1c2e6b0 100644
--- a/website/index.html
+++ b/website/index.html
@@ -7,9 +7,9 @@
<script type="text/javascript" src="js/jquery-1.1.3.1.pack.js"></script>
<script type="text/javascript" src="js/jquery.spritely-0.3b.js"></script>
<script type="text/javascript">
- $(document).ready(function(){
- $('#bling-screen').sprite({fps: 2, no_of_frames: 21}).activeOnClick().active();
- });
+ $(document).ready(function(){
+ $('#bling-screen').sprite({fps: 2, no_of_frames: 21}).activeOnClick().active();
+ });
</script>
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/text.css" />
@@ -21,159 +21,163 @@
<body>
<div class="container_16">
<div id="header">
- <div class="grid_6" id="logo">
- <h1>
- <a href="http://moksha-project.org/">Moksha</a>
- </h1>
- </div>
- <div class="grid_10 nav">
- <ul>
- <li><a href="#">Download</a></li>
- <li><a href="http://moksha.csh.rit.edu/apps/docs/index.html">Documentation</a></li>
- <li><a href="https://fedorahosted.org/moksha/">Wiki</a></li>
- <li><a href="https://fedorahosted.org/mailman/listinfo/moksha">Mailing List</a></li>
- <li><a href="http://webchat.freenode.net/?channels=moksha&uio=d4">IRC / Chat</a></li>
- </ul>
- </div>
+ <div class="grid_6" id="logo">
+ <h1>
+ <a href="http://moksha-project.org/">Moksha</a>
+ </h1>
+ </div>
+ <div class="grid_10 nav">
+ <ul>
+ <li><a href="#">Download</a></li>
+ <li><a href="http://mokshaproject.net/apps/docs/index.html">Documentation</a></li>
+ <li><a href="https://fedorahosted.org/moksha/">Wiki</a></li>
+ <li><a href="https://fedorahosted.org/mailman/listinfo/moksha">Mailing List</a></li>
+ <li><a href="http://webchat.freenode.net/?channels=moksha&uio=d4">IRC / Chat</a></li>
+ </ul>
+ </div>
<div class="grid_16">
- <h2>A web framework for highly-interactive, realtime apps.</h2>
- </div>
- <div class="grid_16" id="bling-frame">
-
- <div id="bling-screen"> </div>
- </div>
+ <h2>A web framework for highly-interactive, realtime apps.</h2>
+ </div>
+ <div class="grid_16" id="bling-frame">
+
+ <div id="bling-screen"> </div>
+ </div>
</div>
<div id="page">
- <div class="grid_10" id="content">
- <h2>What is Moksha?</h2>
- <!-- add 2x2 grid here -->
- <div class="alpha grid_5">
- <h3>A Platform</h3>
- <p>Moksha is a highly-scalable platform for creating dashboards of live widgets. Moksha makes it simple for these widgets to extract and extend data from arbitrary resources in an intuitive & efficient manner.</p>
- </div>
- <div class="omega grid_5">
- <h3>An Architecture</h3>
- <p>Moksha brings existing technologies together to create a next-generation web architecture that is designed to simplify the creation of create rich, live web applications that can easily bridge existing services.</p>
- </div>
- <div class="alpha grid_5">
- <h3>A Framework</h3>
- <p>Compiled from the best-of-breed components, Moksha applications are written using stable pre-existing modules that allow for the rapid creation of powerful applications.</p>
- </div>
- <div class="omega grid_5">
- <h3>A Hub</h3>
- <p>Moksha also acts as a live notification hub that allows people and other applications and services to create,
-publish, and subscribe to arbitrary message streams.</p>
- </div>
-
- <h2>Features</h2>
- <div class="alpha grid_5">
- <ul>
- <li>Free & Open Source</li>
- <li>Supported by open standards</li>
- <li>Comprehensive WSGI middleware stack</li>
- <li>Application and widget plugin architecture</li>
- <li>Low-latency browser socket</li>
- <li>Live widget API</li>
- <li>Supports 100% AMQP from the browser to the broker</li>
- </ul>
- </div>
+ <div class="grid_10" id="content">
+ <h2>What is Moksha?</h2>
+ <!-- add 2x2 grid here -->
+ <div class="alpha grid_5">
+ <h3>A Platform</h3>
+ <p>Moksha is a highly-scalable platform for creating dashboards of live widgets. Moksha makes it simple for these widgets to extract and extend data from arbitrary resources in an intuitive and efficient manner.</p>
+ </div>
+ <div class="omega grid_5">
+ <h3>An Architecture</h3>
+ <p>Moksha brings existing technologies together to create a next-generation web architecture that is designed to simplify the creation of create rich, live web applications that can easily bridge existing services.</p>
+ </div>
+ <div class="alpha grid_5">
+ <h3>A Framework</h3>
+ <p>Built using best-of-breed components, Moksha applications are written using stable pre-existing modules that allow for the rapid creation of powerful applications.</p>
+ </div>
+ <div class="omega grid_5">
+ <h3>A Hub</h3>
+ <p>Moksha acts as real-time messaging middleware for your web application, allowing you to publish and subscribe to message queues both on server and from the clients web browser.</p>
+ </div>
+
+ <h2>Features</h2>
+ <div class="alpha grid_5">
+ <ul>
+ <li>Free & Open Source</li>
+ <li>Utilizes by Open Standards</li>
+ <li>Comprehensive WSGI middleware stack</li>
+ <li>Plugin-driven architecture</li>
+ <li>Live widget API</li>
+ <li>Supports 100% AMQP from the browser to the broker</li>
+ <li>Low-latency browser socket</li>
+ </ul>
+ </div>
- <div class="omega grid_5">
- <ul>
- <li>Scalable architecture</li>
- <li>External resource connectors</li>
- <li>Messaging hub that can integrate with an AMQP broker</li>
- <li>Message producer/consumer API</li>
- <li>Leverages the power of TurboGears2</li>
- <li>Dynamic extension points</li>
- <li>Dashboard creation API</li>
- </ul>
- </div>
- <h2>Architecture</h2>
- <div class="grid_10">
- <a href="http://moksha.csh.rit.edu/apps/docs/main/Architecture.html"><img src="img/moksha-architecture.png" alt="Architecture diagram for Moksha"/></a>
- <ul>
- <li class="web-doc"><a href="http://moksha.csh.rit.edu/apps/docs/main/Architecture.html">Full architecture documentation</a> is available.</li>
- </ul>
- </div>
-
- <h2>Demo Site</h2>
- <div class="grid_10">
- <p>View a demo of Moksha in action: <a href="http://moksha.csh.rit.edu/">http://moksha.csh.rit.edu/</a></p>
- </div>
- </div>
- <div class="grid_6" id="sidebar">
- <h2 id="download"><a href="#">Download Now</a></h2>
+ <div class="omega grid_5">
+ <ul>
+ <li>Messaging hub that can integrate with an AMQP broker</li>
+ <li>Message producer/consumer API</li>
+ <li>Scalable architecture</li>
+ <li>External resource connectors</li>
+ <li>Dynamic extension points</li>
+ <li>Dashboard creation API</li>
+ <li>Leverages the power of TurboGears2</li>
+ </ul>
+ </div>
+ <h2>Architecture</h2>
+ <div class="grid_10">
+ <a href="http://mokshaproject.net/apps/docs/main/Architecture.html"><img src="img/moksha-architecture.png" alt="Architecture diagram for Moksha"/></a>
+ <ul>
+ <li class="web-doc"><a href="http://mokshaproject.net/apps/docs/main/Architecture.html">Full architecture documentation</a> is available.</li>
+ </ul>
+ </div>
+
+ <h2>Demo Site</h2>
+ <div class="grid_10">
+ <p>View a demo of Moksha in action: <a href="http://mokshaproject.net/">http://mokshaproject.net/</a></p>
+ </div>
+ </div>
+ <div class="grid_6" id="sidebar">
+ <h2 id="download"><a href="#">Download Now</a></h2>
- <h3>Supported Platforms</h3>
- <p>Fedora 13, Fedora 14, Red Hat Enterprise Linux 6, OS X ...?</p>
+ <h3>Supported Platforms</h3>
+ <p>Moksha has been tested on Fedora/RHEL, Ubuntu/Debian and OSX. However, since it's written in Python it should be able to work on almost all platforms.</p>
- <h3>Installation Instructions</h3>
- <p>Right click the 'Download Now' link above, save to your computer, move the file to /etc/yum.repos.d, and then run: <code>yum install moksha-{server,hub,docs}</code>.</p>
+ <h3>Different ways to use Moksha</h3>
+ <ul>
+ <li class="doc"><a href="http://mokshaproject.net/apps/docs/main/UsingLiveSocketOutsideOfMoksha.html">Bringing real-time functionality to your existing site</a></li>
+ <li class="doc"><a href="http://mokshaproject.net/apps/docs/main/IntegratingWithTG2.html">As middleware in a TurboGears2 application</a></li>
+ <li class="doc"><a href="http://mokshaproject.net/apps/docs/main/GettingStarted.html">Running your apps and widgets inside of Moksha</a></li>
+ </ul>
+ <h3>Getting Started</h3>
+ <ul>
+ <li class="doc"><a href="http://mokshaproject.net/apps/docs/main/GettingStarted.html">Installation Instructions</a></li>
+ <li class="doc"><a href="http://mokshaproject.net/apps/docs/main/HelloWorld.html">Hello World Demo</a></li>
+ <li class="doc"><a href="http://mokshaproject.net/apps/docs/index.html">Documentation</a></li>
+ <li class="web-doc"><a href="https://fedorahosted.org/moksha/wiki/FAQ">Frequently-Asked Questions</a></li>
+ <li class="web-doc"><a href="https://fedorahosted.org/moksha/report/1">Active Bug List</a></li>
+ <li class="web-doc"><a href="https://fedorahosted.org/moksha/wiki/FAQ">File a New Bug</a></li>
+ </ul>
- <h2>Moksha Quickstart</h2>
- <a href="http://moksha.csh.rit.edu/apps/docs/main/HelloWorld.html"><img src="img/quickstart-screenshot.png" alt="tutorial screenshot" /></a>
- <p>This 15-minute quickstart demo will introduce you to working with Moksha in building a basic example dashboard with live graphs.</p>
+ <h2>Using with TurboGears2</h2>
+ <a href="http://mokshaproject.net/apps/docs/main/IntegratingWithTG2.html"><img src="img/quickstart-screenshot.png" alt="tutorial screenshot" /></a>
+ <p>This demo will introduce you to working with Moksha within your existing TurboGears application through building a basic example dashboard with live graphs.</p>
- <h2>Join the Team</h2>
- <p>Want to help us out?</p>
- <h3>Codebase Summary</h3>
- <p>Moksha's codebase is primarily written in <strong>Python</strong> and <strong>Javascript</strong>.</p>
- <ul>
- <li class="web-doc"><a href="http://moksha.csh.rit.edu/apps/docs/main/Architecture.html">Full architecture documentation</a> is available.</li>
- </ul>
-
- <h3>Technology Summary</h3>
- <div class="grid_3 alpha">
- <ul>
- <li><a href="http://python.org">Python</a></li>
- <li><a href="http://turbogears.org/">TurboGears 2</a></li>
- <li><a href="http://pylonshq.com/">Pylons</a></li>
- <li><a href="http://pythonpaste.org/">Paste</a></li>
- <li><a href="http://www.wsgi.org/wsgi/">WSGI Middleware</a></li>
- <li><a href="http://orbited.org/">Orbited</a></li>
- <li><a href="http://amqp.org">AMQP</a>/<a href="http://qpid.apache.org/">Qpid</a></li>
- </ul>
- </div>
- <div class="grid_3 omega">
- <ul>
- <li><a href="http://jquery.com">JQuery</a></li>
- <li><a href="http://toscawidgets.org/">ToscaWidgets</a></li>
- <li><a href="http://www.makotemplates.org/">Mako</a></li>
- <li><a href="http://genshi.edgewall.org/">Genshi</a></li>
- <li><a href="http://sqlalchemy.org">SQL Alchemy</a></li>
- <li><a href="http://js.io/">js.io</a></li>
- <li><a href="http://twistedmatrix.com/trac/">Twisted</a></li>
- </ul>
- </div>
- <h3>Getting Started</h3>
- <ul>
- <li class="doc"><a href="http://moksha.csh.rit.edu/apps/docs/main/GettingStarted.html">Installation Instructions & Development Setup</a></li>
- <li class="web-doc"><a href="https://fedorahosted.org/moksha/wiki/FAQ">Frequently-Asked Questions</a></li>
- <li class="doc"><a href="http://moksha.csh.rit.edu/apps/docs/index.html">Moksha Documentation</a></li>
- <li class="web-doc"><a href="https://fedorahosted.org/moksha/report/1">Active Bug List</a></li>
- <li class="web-doc"><a href="https://fedorahosted.org/moksha/wiki/FAQ">File a New Bug</a></li>
- </ul>
- <h3>Code Repository</h3>
- <ul>
- <li><a href="https://fedorahosted.org/moksha/browser">git://git.fedorahosted.org/git/moksha.git</a></li>
- </ul>
- </div>
+ <h2>Join the Team</h2>
+ <p>Want to help us out?</p>
+ <h3>Codebase Summary</h3>
+ <p>Moksha's codebase is primarily written in <strong>Python</strong> and <strong>Javascript</strong>.</p>
+ <ul>
+ <li class="web-doc"><a href="http://mokshaproject.net/apps/docs/main/Architecture.html">Full architecture documentation</a> is available.</li>
+ </ul>
+
+ <h3>Technology Summary</h3>
+ <div class="grid_3 alpha">
+ <ul>
+ <li><a href="http://python.org">Python</a></li>
+ <li><a href="http://turbogears.org/">TurboGears 2</a></li>
+ <li><a href="http://pylonshq.com/">Pylons</a></li>
+ <li><a href="http://pythonpaste.org/">Paste</a></li>
+ <li><a href="http://www.wsgi.org/wsgi/">WSGI Middleware</a></li>
+ <li><a href="http://orbited.org/">Orbited</a></li>
+ <li><a href="http://amqp.org">AMQP</a>/<a href="http://qpid.apache.org/">Qpid</a></li>
+ </ul>
+ </div>
+ <div class="grid_3 omega">
+ <ul>
+ <li><a href="http://jquery.com">JQuery</a></li>
+ <li><a href="http://toscawidgets.org/">ToscaWidgets</a></li>
+ <li><a href="http://www.makotemplates.org/">Mako</a></li>
+ <li><a href="http://genshi.edgewall.org/">Genshi</a></li>
+ <li><a href="http://sqlalchemy.org">SQL Alchemy</a></li>
+ <li><a href="http://js.io/">js.io</a></li>
+ <li><a href="http://twistedmatrix.com/trac/">Twisted</a></li>
+ </ul>
+ </div>
+ <h3>Code Repository</h3>
+ <ul>
+ <li><a href="https://fedorahosted.org/moksha/browser">git://git.fedorahosted.org/git/moksha.git</a></li>
+ </ul>
+ </div>
</div>
</div>
<div id="footer">
<div class="container_16">
- <div class="grid_16">
- <a href="http://turbogears.org/"><img src="img/promo-button-tg.png" alt="" /></a>
- <a href="http://python.org"><img src="img/promo-button-python.png" alt="" /></a>
- <a href="http://www.apache.org/licenses/LICENSE-2.0.html"><img src="img/apache_license-greyscale-100px.png" alt="" /></a>
- </div>
- <div class="grid_16">
- <a href="http://redhat.com"><img src="img/promo-sponsor-redhat.png" alt="Red Hat, Inc." /></a>
+ <div class="grid_16">
+ <a href="http://turbogears.org/"><img src="img/promo-button-tg.png" alt="" /></a>
+ <a href="http://python.org"><img src="img/promo-button-python.png" alt="" /></a>
+ <a href="http://www.apache.org/licenses/LICENSE-2.0.html"><img src="img/apache_license-greyscale-100px.png" alt="" /></a>
+ </div>
+ <div class="grid_16">
+ <a href="http://redhat.com"><img src="img/promo-sponsor-redhat.png" alt="Red Hat, Inc." /></a>
<p>Moksha is sponsored by <a href="http://redhat.com">Red Hat, Inc.</a> <br />© 2008-2010 Red Hat, Inc. and others. <br/> The Apache logo is a trademark of The Apache Software Foundation.</p>
- </div>
+ </div>
</div>
<div class="clear"></div>
</div>
commit bc5bf60e65d9789f1e7d690cfe31eea897e145bc
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Dec 21 16:51:46 2010 -0500
Link to our new homepage from the demo menu
diff --git a/moksha/apps/menus/moksha/apps/menus/default.py b/moksha/apps/menus/moksha/apps/menus/default.py
index f00d7a0..5ee9175 100644
--- a/moksha/apps/menus/moksha/apps/menus/default.py
+++ b/moksha/apps/menus/moksha/apps/menus/default.py
@@ -72,7 +72,8 @@ class MokshaDefaultMenu(MokshaMenu):
<br>Moksha is a platform for creating live collaborative web applications.<br><br>
</a>
<a rel="separator"></a>
- <a href="/apps/docs/">Documentation</a>
+ <a href="http://mokshaproject.net/">Homepage</a>
+ <a href="http://mokshaproject.net/apps/docs/">Documentation</a>
<a href="https://fedorahosted.org/moksha/report/3">Tickets</a>
<a href="https://fedorahosted.org/moksha/">Wiki</a>
"""
commit 4c80693c164beb87b793c04ab92443e98f83ee6f
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Dec 21 16:51:27 2010 -0500
Link to CSRF middleware in our Moksha Labs doc
diff --git a/docs/main/MokshaLabs.rst b/docs/main/MokshaLabs.rst
index 1c74b16..13dc2d4 100644
--- a/docs/main/MokshaLabs.rst
+++ b/docs/main/MokshaLabs.rst
@@ -8,6 +8,7 @@ The Moksha Labs is an experimental R&D playground for reusable apps & widgets.
LiveWidget
Feeds
+ CSRFProtection
MokshaContainerWidgets
Connectors
Blueprint
commit 131deba3a28593acfdf2672ef3e1c7b173b08359
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Dec 21 16:50:57 2010 -0500
Add information about orbited configuration to the message broker doc
diff --git a/docs/main/MessageBrokers.rst b/docs/main/MessageBrokers.rst
index 3b14357..088829b 100644
--- a/docs/main/MessageBrokers.rst
+++ b/docs/main/MessageBrokers.rst
@@ -19,11 +19,26 @@ can change the `stomp_broker` in the Moksha configuration file to point to a
different STOMP broker -- `RabbitMQ <http://rabbitmq.com>`_ with the STOMP-adapter has been tested as
well.
+Make sure Orbited is configured to proxy connections to your STOMP Broker in your ``/etc/orbited.cfg``
+
+.. code-block:: none
+
+ [access]
+ * -> localhost:61613
+
+You can also enable the built-in STOMP broker within Orbited, MorbidQ, by doing the following in the ``orbited.cfg``:
+
+.. code-block:: none
+
+ [listen]
+ stomp://:61613
+
+
`AMQP <http://amqp.org>`_
-------------------------
Plugging an `AMQP <http://amqp.org>`_ broker into Moksha is trivial. Simply
-add an `amqp_broker` to your configuration, and change the live socket backend:
+add an `amqp_broker` to your configuration, and change the live socket backend in Moksha's ``development.ini`` or ``production.ini``:
.. code-block:: none
@@ -38,6 +53,16 @@ add an `amqp_broker` to your configuration, and change the live socket backend:
The :class:`MokshaHub` will then automatically connect up to your AMQP broker and proxy messages to the STOMP broker and Moksha Consumers.
-AMQP support in Moksha has been tested with `Qpid <http://qpid.apache.org>`_.
+You will then need to edit your Orbited configuration to allow proxying to your
+AMQP Broker in your``/etc/orbited.cfg``
+
+.. code-block:: none
+
+ [access]
+ * -> localhost:5672
+
+.. note::
-`RabbitMQ <http://rabbitmq.com>`_ support is under development. See the :doc:`RabbitMQ` documentation for details on testing it.
+ AMQP support in Moksha has been tested with `Qpid <http://qpid.apache.org>`_.
+
+ `RabbitMQ <http://rabbitmq.com>`_ support is under development. See the :doc:`RabbitMQ` documentation for details on testing it.
commit 28572a555f744e03981c0d10540a1b7342ff094c
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Dec 21 16:50:44 2010 -0500
Minor tweak to the layout of the Getting Started doc
diff --git a/docs/main/GettingStarted.rst b/docs/main/GettingStarted.rst
index 0c20231..6c08639 100644
--- a/docs/main/GettingStarted.rst
+++ b/docs/main/GettingStarted.rst
@@ -5,6 +5,7 @@ Getting Started with Moksha
There are currently two ways of installing and running Moksha.
.. toctree::
+ :maxdepth: 1
RPMInstallation
VirtualenvInstallation
commit 7423d7e30bafad5fa49ad4b9936b0f1a5b745aba
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Dec 21 16:50:30 2010 -0500
Rename the security doc to CSRF
diff --git a/docs/main/CSRFProtection.rst b/docs/main/CSRFProtection.rst
index 0932a74..08d9c98 100644
--- a/docs/main/CSRFProtection.rst
+++ b/docs/main/CSRFProtection.rst
@@ -1,8 +1,5 @@
-Security
-========
-
Cross-site Request Forgery Protection
--------------------------------------
+=====================================
Moksha offers a layer of CSRF protection for authenticated users.
For more information on `CSRF`, see the `Wikipedia entry
commit 651a4c00414f0c1769ac858811717bae2c3842c8
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Dec 21 16:50:03 2010 -0500
Re-organize the main docs page
diff --git a/docs/_templates/indexcontent.html b/docs/_templates/indexcontent.html
index ecfeb3c..a7b918d 100644
--- a/docs/_templates/indexcontent.html
+++ b/docs/_templates/indexcontent.html
@@ -7,35 +7,31 @@
<span class="linkdescr">High-level goals and concepts</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("main/GettingStarted") }}">Getting Started</a><br/>
<span class="linkdescr">Instructions for diving in</span></p>
- <p class="biglink"><a class="biglink" href="{{ pathto("main/HelloWorld") }}">Hello World Demo</a><br/>
- <span class="linkdescr">A simple Hello World demo</span></p>
- <p class="biglink"><a class="biglink" href="{{ pathto("main/MokshaLabs") }}">Moksha Labs</a><br/>
- <span class="linkdescr">Experimental apps and widgets</span></p>
+ <p class="biglink"><a class="biglink" href="{{ pathto("main/PluginEntryPoints") }}">Plugin Entry Points</a><br/>
+ <span class="linkdescr">Details on plugging in various components</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("main/Messaging") }}">Messaging</a><br/>
<span class="linkdescr">Moksha's real-time messaging layer</span></p>
- <p class="biglink"><a class="biglink" href="{{ pathto("main/Connectors") }}">Connectors</a><br/>
- <span class="linkdescr">Data connector interfaces</span></p>
- <p class="biglink"><a class="biglink" href="{{ pathto("main/Middleware") }}">WSGI Middleware</a><br/>
- <span class="linkdescr">A description of Moksha's WSGI middleware</span></p>
- <p class="biglink"><a class="biglink" href="{{ pathto("main/Security") }}">Security</a><br/>
- <span class="linkdescr">Security features provided by Moksha</span></p>
+ <p class="biglink"><a class="biglink" href="{{ pathto("main/IntegratingWithTG2") }}">TurboGears2</a><br/>
+ <span class="linkdescr">Using Moksha with TurboGears2</span></p>
+ <p class="biglink"><a class="biglink" href="{{ pathto("main/Development") }}">Development</a><br/>
+ <span class="linkdescr">A handbook for hacking on Moksha</span></p>
+ <p class="biglink"><a class="biglink" href="{{ pathto("main/MokshaLabs") }}">Moksha Labs</a><br/>
+ <span class="linkdescr">Experimental apps, widgets, and middleware</span></p>
</td><td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("main/Architecture") }}">The Architecture</a><br/>
<span class="linkdescr">Features of and the technology behind them</span></p>
+ <p class="biglink"><a class="biglink" href="{{ pathto("main/HelloWorld") }}">Hello World Demo</a><br/>
+ <span class="linkdescr">A simple Hello World demo</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("main/QuickstartTemplates") }}">Quickstart Templates</a><br/>
<span class="linkdescr">Quickly create Moksha components</span></p>
+ <p class="biglink"><a class="biglink" href="{{ pathto("main/Middleware") }}">WSGI Middleware</a><br/>
+ <span class="linkdescr">A description of Moksha's WSGI middleware</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("main/UsingLiveSocketOutsideOfMoksha") }}">Using the Live Socket outside of Moksha</a><br/>
<span class="linkdescr">Hook any web page up to your message broker</span></p>
- <p class="biglink"><a class="biglink" href="{{ pathto("main/PluginEntryPoints") }}">Plugin Entry Points</a><br/>
- <span class="linkdescr">Details on plugging in various components</span></p>
- <p class="biglink"><a class="biglink" href="{{ pathto("main/IntegratingWithTG2") }}">TurboGears2</a><br/>
- <span class="linkdescr">Using Moksha with TurboGears2</span></p>
- <p class="biglink"><a class="biglink" href="{{ pathto("main/Development") }}">Development</a><br/>
- <span class="linkdescr">A handbook for hacking on Moksha</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("main/Deployment") }}">Deployment</a><br/>
<span class="linkdescr">Recipies for deploying and scaling Moksha</span></p>
<p class="biglink"><a class="biglink" href="http://moksha.csh.rit.edu">Demo Dashboard</a><br/>
- <span class="linkdescr">A simple demo Moksha dashboard</span></p>
+ <span class="linkdescr">A real-time demo Moksha dashboard</span></p>
</td></tr>
</table>
@@ -57,26 +53,33 @@
<p><strong>Meta information:</strong></p>
<table class="contentstable" align="center"><tr>
<td width="50%">
+ <p class="biglink"><a class="biglink" href="http://mokshaproject.net">Homepage</a></p>
+ </td>
+ <td width="50%">
<p class="biglink"><a class="biglink" href="https://fedorahosted.org/moksha/newticket">Reporting bugs</a></p>
</td>
+ </tr><tr>
<td width="50%">
<p class="biglink"><a class="biglink" href="https://fedorahosted.org/moksha/report/1">Active Tickets</a></p>
- </td></tr>
- <tr>
+ </td>
<td width="50%">
<p class="biglink"><a class="biglink" href="https://fedorahosted.org/moksha/timeline">Timeline</a></p>
</td>
+</tr><tr>
<td width="50%">
<p class="biglink"><a class="biglink" href="https://fedorahosted.org/moksha/roadmap">Roadmap</a></p>
- </td></tr>
- <tr>
+ </td>
<td width="50%">
<p class="biglink"><a class="biglink" href="http://moksha.fedorahosted.org">Wiki</a></p>
</td>
+</tr><tr>
<td width="50%">
<p class="biglink"><a class="biglink" href="https://fedorahosted.org/mailman/listinfo/moksha">Mailing List</a></p>
- </td></tr>
- <tr>
+ </td>
+ <td width="50%">
+ <p class="biglink"><a class="biglink" href="https://fedorahosted.org/moksha/browser">Source Code</a></p>
+ </td>
+</tr><tr>
<td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("license") }}">License</a></p>
</td>
diff --git a/docs/main/CSRFProtection.rst b/docs/main/CSRFProtection.rst
new file mode 100644
index 0000000..0932a74
--- /dev/null
+++ b/docs/main/CSRFProtection.rst
@@ -0,0 +1,28 @@
+Security
+========
+
+Cross-site Request Forgery Protection
+-------------------------------------
+
+Moksha offers a layer of CSRF protection for authenticated users.
+For more information on `CSRF`, see the `Wikipedia entry
+<http://en.wikipedia.org/wiki/Cross-site_request_forgery>`_
+
+You can enable/disable this middleware by using the following configuration
+option in your ``production.ini`` file:
+
+.. code-block:: python
+
+ moksha.csrf_protection = True
+
+WSGI Middleware
+~~~~~~~~~~~~~~~
+
+.. autoclass:: moksha.middleware.csrf.CSRFProtectionMiddleware
+ :members: __call__
+
+:mod:`repoze.who` metadata provider
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. autoclass:: moksha.middleware.csrf.CSRFMetadataProvider
+ :members: add_metadata
diff --git a/docs/main/Security.rst b/docs/main/Security.rst
deleted file mode 100644
index 0932a74..0000000
--- a/docs/main/Security.rst
+++ /dev/null
@@ -1,28 +0,0 @@
-Security
-========
-
-Cross-site Request Forgery Protection
--------------------------------------
-
-Moksha offers a layer of CSRF protection for authenticated users.
-For more information on `CSRF`, see the `Wikipedia entry
-<http://en.wikipedia.org/wiki/Cross-site_request_forgery>`_
-
-You can enable/disable this middleware by using the following configuration
-option in your ``production.ini`` file:
-
-.. code-block:: python
-
- moksha.csrf_protection = True
-
-WSGI Middleware
-~~~~~~~~~~~~~~~
-
-.. autoclass:: moksha.middleware.csrf.CSRFProtectionMiddleware
- :members: __call__
-
-:mod:`repoze.who` metadata provider
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. autoclass:: moksha.middleware.csrf.CSRFMetadataProvider
- :members: add_metadata
13 years, 6 months
ez_setup/__init__.py ez_setup/README.txt
by Luke Macken
ez_setup/README.txt | 14 ---
ez_setup/__init__.py | 229 ---------------------------------------------------
2 files changed, 243 deletions(-)
New commits:
commit e9d287ef2410fc19e0f3e97d381dc780bbbf90ef
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Dec 20 19:08:07 2010 -0500
Remove the useless ez_setup module
diff --git a/ez_setup/README.txt b/ez_setup/README.txt
deleted file mode 100644
index 77c986d..0000000
--- a/ez_setup/README.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-This directory exists so that Subversion-based projects can share a single
-copy of the ``ez_setup`` bootstrap module for ``setuptools``, and have it
-automatically updated in their projects when ``setuptools`` is updated.
-
-For your convenience, you may use the following svn:externals definition::
-
- ez_setup svn://svn.eby-sarna.com/svnroot/ez_setup
-
-You can set this by executing this command in your project directory::
-
- svn propedit svn:externals .
-
-And then adding the line shown above to the file that comes up for editing.
-Then, whenever you update your project, ``ez_setup`` will be updated as well.
diff --git a/ez_setup/__init__.py b/ez_setup/__init__.py
deleted file mode 100644
index 6473c14..0000000
--- a/ez_setup/__init__.py
+++ /dev/null
@@ -1,229 +0,0 @@
-#!python
-"""Bootstrap setuptools installation
-
-If you want to use setuptools in your package's setup.py, just include this
-file in the same directory with it, and add this to the top of your setup.py::
-
- from ez_setup import use_setuptools
- use_setuptools()
-
-If you want to require a specific version of setuptools, set a download
-mirror, or use an alternate download directory, you can do so by supplying
-the appropriate options to ``use_setuptools()``.
-
-This file can also be run as a script to install or upgrade setuptools.
-"""
-import sys
-DEFAULT_VERSION = "0.6c7"
-DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
-
-md5_data = {
- 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
- 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
- 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
- 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
- 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
- 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
- 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
- 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
- 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
- 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
- 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
- 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
- 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
- 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
- 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
- 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
- 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
- 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
- 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
- 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
- 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
- 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
- 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
- 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
- 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2',
- 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e',
- 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372',
-}
-
-import sys, os
-
-def _validate_md5(egg_name, data):
- if egg_name in md5_data:
- from md5 import md5
- digest = md5(data).hexdigest()
- if digest != md5_data[egg_name]:
- print >>sys.stderr, (
- "md5 validation of %s failed! (Possible download problem?)"
- % egg_name
- )
- sys.exit(2)
- return data
-
-
-def use_setuptools(
- version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
- download_delay=15
-):
- """Automatically find/download setuptools and make it available on sys.path
-
- `version` should be a valid setuptools version number that is available
- as an egg for download under the `download_base` URL (which should end with
- a '/'). `to_dir` is the directory where setuptools will be downloaded, if
- it is not already available. If `download_delay` is specified, it should
- be the number of seconds that will be paused before initiating a download,
- should one be required. If an older version of setuptools is installed,
- this routine will print a message to ``sys.stderr`` and raise SystemExit in
- an attempt to abort the calling script.
- """
- try:
- import setuptools
- if setuptools.__version__ == '0.0.1':
- print >>sys.stderr, (
- "You have an obsolete version of setuptools installed. Please\n"
- "remove it from your system entirely before rerunning this script."
- )
- sys.exit(2)
- except ImportError:
- egg = download_setuptools(version, download_base, to_dir, download_delay)
- sys.path.insert(0, egg)
- import setuptools; setuptools.bootstrap_install_from = egg
-
- import pkg_resources
- try:
- pkg_resources.require("setuptools>="+version)
-
- except pkg_resources.VersionConflict, e:
- # XXX could we install in a subprocess here?
- print >>sys.stderr, (
- "The required version of setuptools (>=%s) is not available, and\n"
- "can't be installed while this script is running. Please install\n"
- " a more recent version first.\n\n(Currently using %r)"
- ) % (version, e.args[0])
- sys.exit(2)
-
-def download_setuptools(
- version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
- delay = 15
-):
- """Download setuptools from a specified location and return its filename
-
- `version` should be a valid setuptools version number that is available
- as an egg for download under the `download_base` URL (which should end
- with a '/'). `to_dir` is the directory where the egg will be downloaded.
- `delay` is the number of seconds to pause before an actual download attempt.
- """
- import urllib2, shutil
- egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
- url = download_base + egg_name
- saveto = os.path.join(to_dir, egg_name)
- src = dst = None
- if not os.path.exists(saveto): # Avoid repeated downloads
- try:
- from distutils import log
- if delay:
- log.warn("""
----------------------------------------------------------------------------
-This script requires setuptools version %s to run (even to display
-help). I will attempt to download it for you (from
-%s), but
-you may need to enable firewall access for this script first.
-I will start the download in %d seconds.
-
-(Note: if this machine does not have network access, please obtain the file
-
- %s
-
-and place it in this directory before rerunning this script.)
----------------------------------------------------------------------------""",
- version, download_base, delay, url
- ); from time import sleep; sleep(delay)
- log.warn("Downloading %s", url)
- src = urllib2.urlopen(url)
- # Read/write all in one block, so we don't create a corrupt file
- # if the download is interrupted.
- data = _validate_md5(egg_name, src.read())
- dst = open(saveto,"wb"); dst.write(data)
- finally:
- if src: src.close()
- if dst: dst.close()
- return os.path.realpath(saveto)
-
-def main(argv, version=DEFAULT_VERSION):
- """Install or upgrade setuptools and EasyInstall"""
-
- try:
- import setuptools
- except ImportError:
- egg = None
- try:
- egg = download_setuptools(version, delay=0)
- sys.path.insert(0,egg)
- from setuptools.command.easy_install import main
- return main(list(argv)+[egg]) # we're done here
- finally:
- if egg and os.path.exists(egg):
- os.unlink(egg)
- else:
- if setuptools.__version__ == '0.0.1':
- # tell the user to uninstall obsolete version
- use_setuptools(version)
-
- req = "setuptools>="+version
- import pkg_resources
- try:
- pkg_resources.require(req)
- except pkg_resources.VersionConflict:
- try:
- from setuptools.command.easy_install import main
- except ImportError:
- from easy_install import main
- main(list(argv)+[download_setuptools(delay=0)])
- sys.exit(0) # try to force an exit
- else:
- if argv:
- from setuptools.command.easy_install import main
- main(argv)
- else:
- print "Setuptools version",version,"or greater has been installed."
- print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
-
-
-
-def update_md5(filenames):
- """Update our built-in md5 registry"""
-
- import re
- from md5 import md5
-
- for name in filenames:
- base = os.path.basename(name)
- f = open(name,'rb')
- md5_data[base] = md5(f.read()).hexdigest()
- f.close()
-
- data = [" %r: %r,\n" % it for it in md5_data.items()]
- data.sort()
- repl = "".join(data)
-
- import inspect
- srcfile = inspect.getsourcefile(sys.modules[__name__])
- f = open(srcfile, 'rb'); src = f.read(); f.close()
-
- match = re.search("\nmd5_data = {\n([^}]+)}", src)
- if not match:
- print >>sys.stderr, "Internal error!"
- sys.exit(2)
-
- src = src[:match.start(1)] + repl + src[match.end(1):]
- f = open(srcfile,'w')
- f.write(src)
- f.close()
-
-
-if __name__=='__main__':
- if len(sys.argv)>2 and sys.argv[1]=='--md5update':
- update_md5(sys.argv[2:])
- else:
- main(sys.argv[1:])
13 years, 6 months
docs/main
by Luke Macken
docs/main/HelloWorld.rst | 6
docs/main/IntegratingWithTG2.rst | 199 ++++++++++++---------------
docs/main/MokshaHub.rst | 6
docs/main/PluginEntryPoints.rst | 40 ++++-
docs/main/RPMInstallation.rst | 66 +++-----
docs/main/Security.rst | 9 +
docs/main/UsingLiveSocketOutsideOfMoksha.rst | 15 +-
docs/main/VirtualenvInstallation.rst | 10 +
8 files changed, 188 insertions(+), 163 deletions(-)
New commits:
commit aa6d45b6c07701b97f07312ebea4f1536f4cc2d3
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Dec 20 19:06:51 2010 -0500
A ton of documentation improvements...
diff --git a/docs/main/HelloWorld.rst b/docs/main/HelloWorld.rst
index 19c058a..7372a1b 100644
--- a/docs/main/HelloWorld.rst
+++ b/docs/main/HelloWorld.rst
@@ -6,7 +6,11 @@ The goal of this tutorial is to show the simplicity of Moksha's API by creating
basic "Hello World" components in one demo.
:Download: https://fedorahosted.org/releases/m/o/moksha/moksha-helloworld.tar.bz2
-:Demo Source: https://fedorahosted.org/moksha/browser/moksha/apps/helloworld
+:Browse Source: https://fedorahosted.org/moksha/browser/moksha/apps/helloworld
+
+.. note::
+
+ You can easily run this demo by extracting the above tarball, and running ``moksha start`` within it.
The Controller
--------------
diff --git a/docs/main/IntegratingWithTG2.rst b/docs/main/IntegratingWithTG2.rst
index b7c0d30..5eaff7a 100644
--- a/docs/main/IntegratingWithTG2.rst
+++ b/docs/main/IntegratingWithTG2.rst
@@ -7,6 +7,7 @@ The best way to learn how to use Moksha within TurboGears2 by example.
.. image:: ../_static/jqplotdemo.png
:Running demo: http://moksha.csh.rit.edu/apps/jqplotdemo
+:Source code: http://lmacken.fedorapeople.org/JQPlotDemo-0.1dev.tar.gz
We'll take a demo written to show off the :mod:`tw.jquery.jqplot` module for
example. This demo shows off the JQPlotWidget, which queries the server every
@@ -16,9 +17,6 @@ Porting this app to use Moksha's LiveWidget would allow us to create a much
more efficient version of this demo, as it would receive data from the server
asynchronously, instead of polling for it.
-The source code for the original JQPlotDemo can be found here:
-http://lmacken.fedorapeople.org/JQPlotDemo-0.1dev.tar.gz
-
Now we'll go over and explain each patch required to utilize Moksha within this
TurboGears2 application.
@@ -213,106 +211,99 @@ all of the widgets can share.
)
-.. note::
-
- The source code for the MokshaJQPlotDemo can be found here:
-
- http://lmacken.fedorapeople.org/MokshaJQPlotDemo.tar.bz2
-
-
-At this point, you're all set to run `paster serve development.ini` and enjoy
+At this point, you're all set to run ``paster serve development.ini`` and enjoy
your shiny new live web app.
-You are now free to go and deploy your application however you please.
-However, Moksha can run it for you if you wish...
-
---------------------------------------------------------------------------------
-
-Running your app inside of Moksha
----------------------------------
-
-The above example shows how you can easily use Moksha within your existing app.
-Moksha also allows lets you run your app inside of it. Moksha is preconfigured
-to run in an Apache & mod_wsgi environment, which will handle loading and
-mounting your apps within itself.
-
-
-.. warning::
-
- If you're running your app inside of Moksha, you must ensure that you
- are not running the MokshaMiddleware inside of your app first. This
- currently leads to a fun infinite WSGI middleware loop :)
-
- So if you're creating a new app, don't worry about this, but for the above
- example, just remove the `wrap_app=make_moksha_middleware` from your
- `jqplotdemo/config/middleware.py`
-
-
-Create your WSGI app
-~~~~~~~~~~~~~~~~~~~~
-
-If your app is already WSGI-mountable, then don't worry about this. For a TurboGears2 app, it's as easy as:
-
-.. code-block:: diff
-
- --- /dev/null
- +++ b/jqplotdemo/wsgi.py
- @@ -0,0 +1,2 @@
- +from paste.deploy import loadapp
- +application = loadapp('config:/etc/moksha/conf.d/jqplotdemo/production.ini')
-
-
-Make a production configuration
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-In production we want to make sure any caches are setup in the right spot.
-We base the `production.ini` on our existing `development.ini`, and make a tiny tweak.
-
-.. code-block:: diff
-
- --- development.ini
- +++ production.in
- @@ -23,7 +23,7 @@
- use = egg:JQPlotDemo
- lang = en
- -cache_dir = %(here)s/data
- +cache_dir = /var/cache/moksha/jqplotdemo/data
- beaker.session.key = jqplotdemo
-
-.. code-block:: diff
-
- --- a/ MANIFEST.in
- +++ b/ MANIFEST.in
- @@ -2,3 +2,4 @@ recursive-include jqplotdemo/public *
- include jqplotdemo/public/favicon.ico
- recursive-include jqplotdemo/i18n *
- recursive-include jqplotdemo/templates *
- +include production.ini
-
-
-Integrate your TG2/WSGI app into Moksha
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-You can plug your WSGI application into Moksha by using the `moksha.wsgiapp`
-entry-point.
-
-.. code-block:: diff
-
- --- a/ setup.py
- +++ b/ setup.py
- @@ -47,6 +47,9 @@ setup(
- [moksha.stream]
- jqplot_stream = jqplotdemo.streams:JQPlotDemoStream
-
- + [moksha.wsgiapp]
- + jqplotdemo = jqplotdemo.wsgi:application
- +
- [moksha.global]
- moksha_socket = moksha.api.widgets:moksha_socket
-
-
-.. seealso::
-
- :doc:`PluginEntryPoints`
-
-
+To start the message producing data stream, you will need to run the ``moksha-hub``.
+
+
+.. --------------------------------------------------------------------------------
+
+ Running your app inside of Moksha
+ ---------------------------------
+
+ The above example shows how you can easily use Moksha within your existing app.
+ Moksha also allows lets you run your app inside of it. Moksha is preconfigured
+ to run in an Apache & mod_wsgi environment, which will handle loading and
+ mounting your apps within itself.
+
+
+ .. warning::
+
+ If you're running your app inside of Moksha, you must ensure that you
+ are not running the MokshaMiddleware inside of your app first. This
+ currently leads to a fun infinite WSGI middleware loop :)
+
+ So if you're creating a new app, don't worry about this, but for the above
+ example, just remove the `wrap_app=make_moksha_middleware` from your
+ `jqplotdemo/config/middleware.py`
+
+
+ Create your WSGI app
+ ~~~~~~~~~~~~~~~~~~~~
+
+ If your app is already WSGI-mountable, then don't worry about this. For a TurboGears2 app, it's as easy as:
+
+ .. code-block:: diff
+
+ --- /dev/null
+ +++ b/jqplotdemo/wsgi.py
+ @@ -0,0 +1,2 @@
+ +from paste.deploy import loadapp
+ +application = loadapp('config:/etc/moksha/conf.d/jqplotdemo/production.ini')
+
+
+ Make a production configuration
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ In production we want to make sure any caches are setup in the right spot.
+ We base the `production.ini` on our existing `development.ini`, and make a tiny tweak.
+
+ .. code-block:: diff
+
+ --- development.ini
+ +++ production.in
+ @@ -23,7 +23,7 @@
+ use = egg:JQPlotDemo
+ lang = en
+ -cache_dir = %(here)s/data
+ +cache_dir = /var/cache/moksha/jqplotdemo/data
+ beaker.session.key = jqplotdemo
+
+ .. code-block:: diff
+
+ --- a/ MANIFEST.in
+ +++ b/ MANIFEST.in
+ @@ -2,3 +2,4 @@ recursive-include jqplotdemo/public *
+ include jqplotdemo/public/favicon.ico
+ recursive-include jqplotdemo/i18n *
+ recursive-include jqplotdemo/templates *
+ +include production.ini
+
+
+ Integrate your TG2/WSGI app into Moksha
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ You can plug your WSGI application into Moksha by using the `moksha.wsgiapp`
+ entry-point.
+
+ .. code-block:: diff
+
+ --- a/ setup.py
+ +++ b/ setup.py
+ @@ -47,6 +47,9 @@ setup(
+ [moksha.stream]
+ jqplot_stream = jqplotdemo.streams:JQPlotDemoStream
+
+ + [moksha.wsgiapp]
+ + jqplotdemo = jqplotdemo.wsgi:application
+ +
+ [moksha.global]
+ moksha_socket = moksha.api.widgets:moksha_socket
+
+
+ .. seealso::
+
+ :doc:`PluginEntryPoints`
+
+
diff --git a/docs/main/MokshaHub.rst b/docs/main/MokshaHub.rst
index 1886cb3..1003e71 100644
--- a/docs/main/MokshaHub.rst
+++ b/docs/main/MokshaHub.rst
@@ -19,15 +19,15 @@ applications to send messages to a given topic.
Behind the scenes, the :class:`MokshaHub` will automatically connect up to
whatever message brokers are configured, and create a new session. The
:meth:`send_message` method will automatically handle encoding your message to
-JSON (unless you pass `jsonify=False`), and sending it to the appropriate
+JSON (unless you pass ``jsonify=False``), and sending it to the appropriate
message broker.
CentralMokshaHub
----------------
-The :class:`CentralMokshaHub` is the primary consumer of all message `topics`.
+The :class:`CentralMokshaHub` is the primary consumer of all message ``topics``.
It runs outside of the Moksha WSGI application stack, and is automatically
-started by the `start-moksha` script (and can be started manually by running `moksha-hub`.
+started by the ``start-moksha`` script (and can be started manually by running ``moksha-hub``).
The :class:`CentralMokshaHub` currently handles the following tasks:
diff --git a/docs/main/PluginEntryPoints.rst b/docs/main/PluginEntryPoints.rst
index 210e0b0..17b2e1b 100644
--- a/docs/main/PluginEntryPoints.rst
+++ b/docs/main/PluginEntryPoints.rst
@@ -7,18 +7,24 @@ and store them in ``moksha.apps`` and ``moksha._widgets`` dictionaries.
These can then be accessed at any time by any application or widget during
any request.
-Mounting a WSGI application
----------------------------
+What is an Entry Point?
+-----------------------
-You can mount an existing WSGI application by pointing to it
-in the ``setup.py`` on the ``[moksha.wsgiapp]`` entry-point.
+Entry points are a Python setuptools/distribute feature that allows packages to
+register something under a specific key that other packages can query for.
+This is how you make Moksha aware of your widgets/apps/producers/consumers.
+
+Entry points are defined in your projects ``setup.py`` like so:
.. code-block:: python
- [moksha.wsgiapp]
- mywsgiapp = mywsgiapp.wsgiapp:MyWSGIApplication
+ setup(name='moksha.helloworld',
+ ...
+ entry_points="""
+ [moksha.widget]
+ hellowidget = helloworld.widgets:HelloWorldWidget
+ """
-Your WSGI application will then be accessable via ``/apps/mywsgiapp`` in Moksha.
Mounting a TurboGears application
----------------------------------
@@ -48,6 +54,26 @@ You can plug an existing ToscaWidget into Moksha by adding it to the ``[moksha.w
Your Widget will then be accessable via ``/widgets/mywidget`` in Moksha.
+Mounting a WSGI application
+---------------------------
+
+You can mount an existing WSGI application by pointing to it
+in the ``setup.py`` on the ``[moksha.wsgiapp]`` entry-point.
+
+.. code-block:: python
+
+ [moksha.wsgiapp]
+ mywsgiapp = mywsgiapp.wsgiapp:MyWSGIApplication
+
+Your WSGI application will then be accessable via ``/apps/mywsgiapp`` in Moksha.
+
+.. warning::
+
+ At the moment it is not recommened that you mount a TurboGears/Pylons app as
+ a WSGI application inside of Moksha, since the ``pylons.config`` objects
+ will conflict. This issue will be addressed in the future. Instead, you can
+ simply mount a Controller as a ``moksha.application``.
+
Configuration
-------------
diff --git a/docs/main/RPMInstallation.rst b/docs/main/RPMInstallation.rst
index 6f004eb..7903970 100644
--- a/docs/main/RPMInstallation.rst
+++ b/docs/main/RPMInstallation.rst
@@ -2,41 +2,6 @@
Setting up a Moksha RPM & mod_wsgi environment
==============================================
-Setup the TurboGears2/Moksha yum repo
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-At the moment, all of Moksha's dependencies are not all in Fedora. They are
-all currently under review, but in the mean time these instructions will run
-Moksha within a virtual Python environment, without changing your global
-site-packages.
-
-You can track the progress of getting TurboGears2 into Fedora `here <http://fedoraproject.org/wiki/TurboGears2>`_.
-
-To setup Luke Macken's TurboGears2 yum repository, run the following commands
-as root, replacing `$DISTRO` with either `fedora-rawhide`, `fedora-11`,
-`fedora-10`, or `epel-5`.
-
-.. code-block:: bash
-
- cd /etc/yum.repos.d/
- curl -O http://lmacken.fedorapeople.org/rpms/tg2/$DISTRO/tg2.repo
- yum -y install TurboGears2 python-tg-devtools
-
-.. note::
-
- It is recommended that you perform a `yum update` after installing
- the Moksha/TurboGears2 stack, to ensure that you have the latest
- versions of all the dependencies.
-
-.. note::
-
- At the moment the full TurboGears2 stack is not yet fully in
- Fedora/EPEL, so you'll have to hook up a third party repository. You
- can track the status of TurboGears2 in Fedora here:
-
- http://fedoraproject.org/wiki/TurboGears2
-
-
Installing the Moksha Apache/mod_wsgi server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -60,9 +25,29 @@ Running Moksha
Running Orbited
~~~~~~~~~~~~~~~
+Out of the box Orbited comes with a very minimal configuration
+
+Copy over Moksha's Orbited configuration:
+
+.. code-block:: bash
+
+ # cp /etc/moksha/orbited.cfg /etc/orbited.cfg
+
+.. note::
+
+ Moksha's Orbited configuration enables the MorbidQ STOMP message broker by default,
+ for ease of development. This can be disabled by commenting out the line ``stomp://:61613``
+ and the line under the ``[access]`` section.
+
+Starting the Orbited daemon
+
.. code-block:: bash
- $ orbited -c /etc/moksha/orbited.cfg
+ # service orbited start
+
+.. note::
+
+ You can also start orbited by hand by running ``orbited -c /etc/moksha/orbited.cfg``
Running the Moksha Hub
@@ -70,7 +55,7 @@ Running the Moksha Hub
.. code-block:: bash
- $ sudo /sbin/service moksha-hub restart
+ # service moksha-hub start
Install the dependencies and setup your RPM tree
@@ -85,9 +70,10 @@ This step is only necessary if you plan on building moksha apps.
$ sudo yum-builddep -y moksha
-Watching the Error Log
-~~~~~~~~~~~~~~~~~~~~~~
+Watching the logs
+~~~~~~~~~~~~~~~~~
.. code-block:: bash
- $ sudo tail -f /var/log/httpd/moksha_error_log
+ # tail -f /var/log/httpd/moksha_{access,error}_log
+ # tail -f /var/log/moksha/moksha-hub.log
diff --git a/docs/main/Security.rst b/docs/main/Security.rst
index af6eb12..0932a74 100644
--- a/docs/main/Security.rst
+++ b/docs/main/Security.rst
@@ -4,10 +4,17 @@ Security
Cross-site Request Forgery Protection
-------------------------------------
-Moksha offers CSRF protection for authenticated users by default.
+Moksha offers a layer of CSRF protection for authenticated users.
For more information on `CSRF`, see the `Wikipedia entry
<http://en.wikipedia.org/wiki/Cross-site_request_forgery>`_
+You can enable/disable this middleware by using the following configuration
+option in your ``production.ini`` file:
+
+.. code-block:: python
+
+ moksha.csrf_protection = True
+
WSGI Middleware
~~~~~~~~~~~~~~~
diff --git a/docs/main/UsingLiveSocketOutsideOfMoksha.rst b/docs/main/UsingLiveSocketOutsideOfMoksha.rst
index 37dc9ed..daa193c 100644
--- a/docs/main/UsingLiveSocketOutsideOfMoksha.rst
+++ b/docs/main/UsingLiveSocketOutsideOfMoksha.rst
@@ -7,9 +7,12 @@ have to learn Python or TurboGears?
Thankfully, Moksha allows you to leverage it's realtime pipes on any existing
web page without having to write a line of Python code.
-Add code snippet to your web page
-Configure your message broker
-Start Moksha
+This means that you can have your web site listen to topics from your message
+broker, and run javascript when new messages arrive.
+
+All you need to do is add a single ``<script>`` tag to your web site that
+specifies the topic that you wish to listen to, and the javascript function
+that should be called with each new message as they arrive.
.. code-block:: html
@@ -28,7 +31,7 @@ Start Moksha
<script type="text/javascript" src="http://localhost:8080/livesocket?topic=helloworld&callback=consume_message"></script>
</html>
-Caveats
--------
+.. note::
-Must be under the same domain name.
+ In order for the live sockets to work properly, Moksha (specifically Orbited) must be running
+ under the same domain as your web site.
diff --git a/docs/main/VirtualenvInstallation.rst b/docs/main/VirtualenvInstallation.rst
index 7d9d282..23b9fdb 100644
--- a/docs/main/VirtualenvInstallation.rst
+++ b/docs/main/VirtualenvInstallation.rst
@@ -3,7 +3,7 @@ Virtualenv installation
This guide will help quickly get you up and running with a local copy of
Moksha. It will run the Moksha WSGI application using the Paste threaded http
-server, a single orbited daemon with an embeded MorbidQ stomp message broker,
+server, a single Orbited socket-proxy daemon with an embeded MorbidQ stomp message broker,
SQLite SQLAlchemy and Feed databases, and an in-memory cache. This setup is
meant to be dead-simple to get up and running, and is not designed for
production deployments.
@@ -16,11 +16,19 @@ Installing the necessary dependencies
You'll need the `virtualenv <http://pypi.python.org/pypi/virtualenv>`_ package.
+For Fedora/Red Hat/CentOS based environments:
+
.. code-block:: bash
# yum -y install python-virtualenv gcc openssl-devel
# yum-builddep -y python-lxml pyOpenSSL python-sqlite2
+On Ubuntu/Debian:
+
+.. code-block:: bash
+
+ # apt-get install git python-dev python-virtualenv
+
Getting the code
~~~~~~~~~~~~~~~~
13 years, 6 months
4 commits - setup.py website/img website/index.html
by Luke Macken
setup.py | 15 +++------------
website/img/apache_license-greyscale-100px.png |binary
website/index.html | 6 +++---
3 files changed, 6 insertions(+), 15 deletions(-)
New commits:
commit 0e0bf55bce2cca31797668eef3892da716462ba8
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Dec 20 19:06:22 2010 -0500
Add some more TG requirements, since they seem to have been removed upstream.
diff --git a/setup.py b/setup.py
index 173c824..d218d9a 100644
--- a/setup.py
+++ b/setup.py
@@ -44,6 +44,8 @@ setup(
"repoze.what-quickstart",
"repoze.what-pylons",
"repoze.tm2",
+ "Mako",
+ "Genshi",
#"repoze.squeeze", # Not hard requirements
#"repoze.profile", # Not hard requirements
],
commit 81d51f59cad00da49b09958b0f359610f608b0d6
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Dec 20 18:08:16 2010 -0500
Use our new apache license logo
diff --git a/website/index.html b/website/index.html
index d936f86..52c6055 100644
--- a/website/index.html
+++ b/website/index.html
@@ -166,13 +166,13 @@ publish, and subscribe to arbitrary message streams.</p>
<div id="footer">
<div class="container_16">
<div class="grid_16">
- <a href="http://www.gnu.org/licenses/agpl.html"><img src="img/promo-button-agpl.png" alt="" /></a>
- <a href="http://python.org"><img src="img/promo-button-python.png" alt="" /></a>
<a href="http://turbogears.org/"><img src="img/promo-button-tg.png" alt="" /></a>
+ <a href="http://python.org"><img src="img/promo-button-python.png" alt="" /></a>
+ <a href="http://www.apache.org/licenses/LICENSE-2.0.html"><img src="img/apache_license-greyscale-100px.png" alt="" /></a>
</div>
<div class="grid_16">
<a href="http://redhat.com"><img src="img/promo-sponsor-redhat.png" alt="Red Hat, Inc." /></a>
- <p>Moksha is sponsored by <a href="http://redhat.com">Red Hat, Inc.</a> <br />© 2010 Red Hat, Inc. and others.</p>
+ <p>Moksha is sponsored by <a href="http://redhat.com">Red Hat, Inc.</a> <br />© 2008-2010 Red Hat, Inc. and others. <br/> The Apache logo is a trademark of The Apache Software Foundation.</p>
</div>
</div>
<div class="clear"></div>
commit 86440a7b3ccf32e9e328c7d4b7a0f7f5aaada3c8
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Dec 20 18:07:41 2010 -0500
Remove our need for paver to run the setup.py
diff --git a/setup.py b/setup.py
index d3e6d7d..173c824 100644
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,6 @@
# limitations under the License.
from setuptools import setup, find_packages
-from paver.setuputils import find_package_data
setup(
name='moksha',
@@ -53,17 +52,7 @@ setup(
test_suite='nose.collector',
#namespace_packages=['moksha'],
tests_require=['WebTest', 'BeautifulSoup'],
- package_data=find_package_data(exclude=['ez_setup']),
- #package_data={'moksha': ['i18n/*/LC_MESSAGES/*.mo',
- # 'public/favicon',
- # 'public/css/*.css',
- # 'public/images/*.png',
- # 'public/images/*.gif',
- # 'public/images/*.jpg',
- # 'public/javascript/*.js',
- # 'templates/*.html',
- # 'templates/*.mak',
- # 'public/javascript/ui/*.js']},
+ #package_data=find_package_data(exclude=['ez_setup']),
message_extractors = {'moksha': [
('**.py', 'python', None),
('templates/**.mak', 'mako', None),
commit 3c98ee9add4781d6d8f1a51bfaab6f6b59d55cce
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Dec 20 15:17:02 2010 -0500
Add an apache greyscale logo from mizmo
diff --git a/website/img/apache_license-greyscale-100px.png b/website/img/apache_license-greyscale-100px.png
new file mode 100644
index 0000000..d6164a0
Binary files /dev/null and b/website/img/apache_license-greyscale-100px.png differ
13 years, 6 months
2 commits - setup.py
by Luke Macken
setup.py | 3 +++
1 file changed, 3 insertions(+)
New commits:
commit 06254f23ef4ea349953cd6efc0d3c1a8c15e1961
Merge: 8d5d97a... 398fb2f...
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Dec 16 23:27:25 2010 -0500
Merge branch 'master' of git+ssh://git.fedorahosted.org/git/moksha
commit 8d5d97adfb6ff24be95fd47fbfa8676ad7a11d3f
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Dec 16 23:26:59 2010 -0500
Add some repoze deps to our setup.py, since TG removed them
diff --git a/setup.py b/setup.py
index c928235..b02a1e2 100644
--- a/setup.py
+++ b/setup.py
@@ -43,6 +43,9 @@ setup(
"pyOpenSSL",
"BeautifulSoup",
"python-daemon",
+ "repoze.what-quickstart",
+ "repoze.what-pylons",
+ "repoze.tm2",
#"repoze.squeeze", # Not hard requirements
#"repoze.profile", # Not hard requirements
],
13 years, 6 months
demo/demo demo/MANIFEST.in demo/setup.py docs/main moksha/apps
by Luke Macken
demo/MANIFEST.in | 2 -
demo/demo/consumer.py | 14 -------
demo/demo/controllers/root.py | 38 ---------------------
demo/demo/model/__init__.py | 15 --------
demo/demo/model/model.py | 12 ------
demo/demo/producer.py | 8 ----
demo/demo/templates/model.mak | 7 ---
demo/demo/templates/template.mak | 8 ----
demo/demo/widgets/basic.py | 11 ------
demo/demo/widgets/live.py | 23 ------------
demo/setup.py | 35 -------------------
docs/main/HelloWorld.rst | 2 -
moksha/apps/helloworld/MANIFEST.in | 2 +
moksha/apps/helloworld/demo/consumer.py | 14 +++++++
moksha/apps/helloworld/demo/controllers/root.py | 38 +++++++++++++++++++++
moksha/apps/helloworld/demo/model/__init__.py | 15 ++++++++
moksha/apps/helloworld/demo/model/model.py | 12 ++++++
moksha/apps/helloworld/demo/producer.py | 8 ++++
moksha/apps/helloworld/demo/templates/model.mak | 7 +++
moksha/apps/helloworld/demo/templates/template.mak | 8 ++++
moksha/apps/helloworld/demo/widgets/basic.py | 11 ++++++
moksha/apps/helloworld/demo/widgets/live.py | 23 ++++++++++++
moksha/apps/helloworld/setup.py | 35 +++++++++++++++++++
23 files changed, 174 insertions(+), 174 deletions(-)
New commits:
commit 398fb2fea330cf4e5b272cdac2753b912550fa1b
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Dec 16 15:48:23 2010 -0500
Move our helloworld demo to moksha/apps
diff --git a/demo/MANIFEST.in b/demo/MANIFEST.in
deleted file mode 100644
index 2d52b69..0000000
--- a/demo/MANIFEST.in
+++ /dev/null
@@ -1,2 +0,0 @@
-include *.py
-graft demo
diff --git a/demo/demo/__init__.py b/demo/demo/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/demo/demo/consumer.py b/demo/demo/consumer.py
deleted file mode 100644
index 10f4e3b..0000000
--- a/demo/demo/consumer.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from moksha.api.hub.consumer import Consumer
-from demo.model import HelloWorldModel
-
-class HelloWorldConsumer(Consumer):
- topic = 'helloworld'
- app = 'helloworld'
-
- def consume(self, message):
- self.log.info('Received message: ' + message['body']['msg'])
-
- entry = HelloWorldModel()
- entry.message = message['body']['msg']
- self.DBSession.add(entry)
- self.DBSession.commit()
diff --git a/demo/demo/controllers/__init__.py b/demo/demo/controllers/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/demo/demo/controllers/root.py b/demo/demo/controllers/root.py
deleted file mode 100644
index 9486d9d..0000000
--- a/demo/demo/controllers/root.py
+++ /dev/null
@@ -1,38 +0,0 @@
-import moksha
-
-from tg import expose, tmpl_context
-
-class Root(object):
-
- @expose()
- def index(self, *args, **kwargs):
- return 'Hello World!'
-
- @expose('mako:demo.templates.template')
- def mako(self, *args, **kwargs):
- """ An example controller method exposed with a Mako template """
- return {'msg': 'Hello World!'}
-
- @expose('mako:moksha.templates.widget')
- def livewidget(self, *args, **kwargs):
- tmpl_context.widget = moksha.get_widget('live')
- tmpl_context.moksha_socket = moksha.get_widget('moksha_socket')
- return dict(options={})
-
- @expose('mako:demo.templates.model')
- def model(self, *args, **kwargs):
- from demo.model import DBSession, HelloWorldModel
- entries = DBSession.query(HelloWorldModel).limit(10).all()
- return dict(entries=entries)
-
- @expose('mako:demo.templates.model')
- def cached_model(self, *args, **kwargs):
- from pylons import cache
- mycache = cache.get_cache('helloworld')
- entries = mycache.get_value(key='entries', createfunc=self._get_entries,
- expiretime=3600)
- return dict(entries=entries)
-
- def _get_entries(self, *args, **kwargs):
- from demo.model import DBSession, HelloWorldModel
- return DBSession.query(HelloWorldModel).limit(10).all()
diff --git a/demo/demo/model/__init__.py b/demo/demo/model/__init__.py
deleted file mode 100644
index b425716..0000000
--- a/demo/demo/model/__init__.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from zope.sqlalchemy import ZopeTransactionExtension
-from sqlalchemy.orm import scoped_session, sessionmaker
-from sqlalchemy.ext.declarative import declarative_base
-
-maker = sessionmaker(autoflush=True, autocommit=False,
- extension=ZopeTransactionExtension())
-DBSession = scoped_session(maker)
-DeclarativeBase = declarative_base()
-metadata = DeclarativeBase.metadata
-
-def init_model(engine):
- print "init_model(%s)" % engine
- DBSession.configure(bind=engine)
-
-from model import HelloWorldModel
diff --git a/demo/demo/model/model.py b/demo/demo/model/model.py
deleted file mode 100644
index 0f8dbf7..0000000
--- a/demo/demo/model/model.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from datetime import datetime
-from sqlalchemy import Integer, Text, DateTime, Column
-from demo.model import DeclarativeBase
-
-class HelloWorldModel(DeclarativeBase):
- __tablename__ = 'helloworld'
-
- id = Column(Integer, autoincrement=True, primary_key=True)
-
- message = Column(Text)
-
- timestamp = Column(DateTime, default=datetime.now)
diff --git a/demo/demo/producer.py b/demo/demo/producer.py
deleted file mode 100644
index 7ad039d..0000000
--- a/demo/demo/producer.py
+++ /dev/null
@@ -1,8 +0,0 @@
-from datetime import timedelta
-from moksha.api.hub.producer import PollingProducer
-
-class HelloWorldProducer(PollingProducer):
- frequency = timedelta(seconds=3)
-
- def poll(self):
- self.send_message('helloworld', {'msg': 'Hello World!'})
diff --git a/demo/demo/templates/__init__.py b/demo/demo/templates/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/demo/demo/templates/model.mak b/demo/demo/templates/model.mak
deleted file mode 100644
index af50fed..0000000
--- a/demo/demo/templates/model.mak
+++ /dev/null
@@ -1,7 +0,0 @@
-<h1>Entries in the HelloWorld model</h1>
-
-<ul>
- % for entry in entries[::-1]:
- <li>${str(entry.id)} - ${entry.message} - ${str(entry.timestamp)}</li>
- % endfor
-</ul>
diff --git a/demo/demo/templates/template.mak b/demo/demo/templates/template.mak
deleted file mode 100644
index 2010e44..0000000
--- a/demo/demo/templates/template.mak
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
- <head>
- <title>${msg}</title>
- </head>
- <body>
- ${msg}
- </body>
-</html>
diff --git a/demo/demo/widgets/__init__.py b/demo/demo/widgets/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/demo/demo/widgets/basic.py b/demo/demo/widgets/basic.py
deleted file mode 100644
index 7b7e48a..0000000
--- a/demo/demo/widgets/basic.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from tw.api import Widget
-
-class HelloWorldWidget(Widget):
- params = ['msg']
- msg = 'Hello World'
- template = '${msg}'
- engine_name = 'mako'
-
- def update_params(self, d):
- """ Render-time logic """
- super(HelloWorldWidget, self).update_params(d)
diff --git a/demo/demo/widgets/live.py b/demo/demo/widgets/live.py
deleted file mode 100644
index d77e974..0000000
--- a/demo/demo/widgets/live.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from moksha.api.widgets.live import LiveWidget
-
-class HelloWorldWidget(LiveWidget):
- topic = "helloworld"
- template = """
- <b>Hello World Widget</b>
- <form onsubmit="return send_msg()">
- <input name="text" id="text"/>
- </form>
-
- <ul id="data"/>
-
- <script>
- function send_msg() {
- moksha.send_message('helloworld', {'msg': $('#text').val()});
- $('#text').val('');
- return false;
- }
- </script>
- """
- onmessage = """
- $('<li/>').text(json.msg).prependTo('#data');
- """
diff --git a/demo/setup.py b/demo/setup.py
deleted file mode 100644
index 03e57d8..0000000
--- a/demo/setup.py
+++ /dev/null
@@ -1,35 +0,0 @@
-from setuptools import setup, find_packages
-
-setup(
- name='moksha.demo',
- version='0.1',
- description='A Hello World Moksha app',
- author='Luke Macken',
- author_email='lmacken(a)redhat.com',
- url='http://moksha.fedorahosted.org',
- license='GPLv3+',
- install_requires=['Moksha'],
- packages=find_packages(),
- include_package_data=True,
- test_suite='nose.collector',
-
- entry_points="""
-
- [moksha.root]
- root = demo.controllers.root:Root
-
- [moksha.application]
- helloworld = demo.controllers.root:Root
-
- [moksha.producer]
- helloworld = demo.producer:HelloWorldProducer
-
- [moksha.consumer]
- helloworld = demo.consumer:HelloWorldConsumer
-
- [moksha.widget]
- basic = demo.widgets.basic:HelloWorldWidget
- live = demo.widgets.live:HelloWorldWidget
-
- """
-)
diff --git a/docs/main/HelloWorld.rst b/docs/main/HelloWorld.rst
index 415a123..19c058a 100644
--- a/docs/main/HelloWorld.rst
+++ b/docs/main/HelloWorld.rst
@@ -6,7 +6,7 @@ The goal of this tutorial is to show the simplicity of Moksha's API by creating
basic "Hello World" components in one demo.
:Download: https://fedorahosted.org/releases/m/o/moksha/moksha-helloworld.tar.bz2
-:Demo Source: https://fedorahosted.org/moksha/browser/demo
+:Demo Source: https://fedorahosted.org/moksha/browser/moksha/apps/helloworld
The Controller
--------------
diff --git a/moksha/apps/helloworld/MANIFEST.in b/moksha/apps/helloworld/MANIFEST.in
new file mode 100644
index 0000000..2d52b69
--- /dev/null
+++ b/moksha/apps/helloworld/MANIFEST.in
@@ -0,0 +1,2 @@
+include *.py
+graft demo
diff --git a/moksha/apps/helloworld/demo/__init__.py b/moksha/apps/helloworld/demo/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/moksha/apps/helloworld/demo/consumer.py b/moksha/apps/helloworld/demo/consumer.py
new file mode 100644
index 0000000..10f4e3b
--- /dev/null
+++ b/moksha/apps/helloworld/demo/consumer.py
@@ -0,0 +1,14 @@
+from moksha.api.hub.consumer import Consumer
+from demo.model import HelloWorldModel
+
+class HelloWorldConsumer(Consumer):
+ topic = 'helloworld'
+ app = 'helloworld'
+
+ def consume(self, message):
+ self.log.info('Received message: ' + message['body']['msg'])
+
+ entry = HelloWorldModel()
+ entry.message = message['body']['msg']
+ self.DBSession.add(entry)
+ self.DBSession.commit()
diff --git a/moksha/apps/helloworld/demo/controllers/__init__.py b/moksha/apps/helloworld/demo/controllers/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/moksha/apps/helloworld/demo/controllers/root.py b/moksha/apps/helloworld/demo/controllers/root.py
new file mode 100644
index 0000000..9486d9d
--- /dev/null
+++ b/moksha/apps/helloworld/demo/controllers/root.py
@@ -0,0 +1,38 @@
+import moksha
+
+from tg import expose, tmpl_context
+
+class Root(object):
+
+ @expose()
+ def index(self, *args, **kwargs):
+ return 'Hello World!'
+
+ @expose('mako:demo.templates.template')
+ def mako(self, *args, **kwargs):
+ """ An example controller method exposed with a Mako template """
+ return {'msg': 'Hello World!'}
+
+ @expose('mako:moksha.templates.widget')
+ def livewidget(self, *args, **kwargs):
+ tmpl_context.widget = moksha.get_widget('live')
+ tmpl_context.moksha_socket = moksha.get_widget('moksha_socket')
+ return dict(options={})
+
+ @expose('mako:demo.templates.model')
+ def model(self, *args, **kwargs):
+ from demo.model import DBSession, HelloWorldModel
+ entries = DBSession.query(HelloWorldModel).limit(10).all()
+ return dict(entries=entries)
+
+ @expose('mako:demo.templates.model')
+ def cached_model(self, *args, **kwargs):
+ from pylons import cache
+ mycache = cache.get_cache('helloworld')
+ entries = mycache.get_value(key='entries', createfunc=self._get_entries,
+ expiretime=3600)
+ return dict(entries=entries)
+
+ def _get_entries(self, *args, **kwargs):
+ from demo.model import DBSession, HelloWorldModel
+ return DBSession.query(HelloWorldModel).limit(10).all()
diff --git a/moksha/apps/helloworld/demo/model/__init__.py b/moksha/apps/helloworld/demo/model/__init__.py
new file mode 100644
index 0000000..b425716
--- /dev/null
+++ b/moksha/apps/helloworld/demo/model/__init__.py
@@ -0,0 +1,15 @@
+from zope.sqlalchemy import ZopeTransactionExtension
+from sqlalchemy.orm import scoped_session, sessionmaker
+from sqlalchemy.ext.declarative import declarative_base
+
+maker = sessionmaker(autoflush=True, autocommit=False,
+ extension=ZopeTransactionExtension())
+DBSession = scoped_session(maker)
+DeclarativeBase = declarative_base()
+metadata = DeclarativeBase.metadata
+
+def init_model(engine):
+ print "init_model(%s)" % engine
+ DBSession.configure(bind=engine)
+
+from model import HelloWorldModel
diff --git a/moksha/apps/helloworld/demo/model/model.py b/moksha/apps/helloworld/demo/model/model.py
new file mode 100644
index 0000000..0f8dbf7
--- /dev/null
+++ b/moksha/apps/helloworld/demo/model/model.py
@@ -0,0 +1,12 @@
+from datetime import datetime
+from sqlalchemy import Integer, Text, DateTime, Column
+from demo.model import DeclarativeBase
+
+class HelloWorldModel(DeclarativeBase):
+ __tablename__ = 'helloworld'
+
+ id = Column(Integer, autoincrement=True, primary_key=True)
+
+ message = Column(Text)
+
+ timestamp = Column(DateTime, default=datetime.now)
diff --git a/moksha/apps/helloworld/demo/producer.py b/moksha/apps/helloworld/demo/producer.py
new file mode 100644
index 0000000..7ad039d
--- /dev/null
+++ b/moksha/apps/helloworld/demo/producer.py
@@ -0,0 +1,8 @@
+from datetime import timedelta
+from moksha.api.hub.producer import PollingProducer
+
+class HelloWorldProducer(PollingProducer):
+ frequency = timedelta(seconds=3)
+
+ def poll(self):
+ self.send_message('helloworld', {'msg': 'Hello World!'})
diff --git a/moksha/apps/helloworld/demo/templates/__init__.py b/moksha/apps/helloworld/demo/templates/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/moksha/apps/helloworld/demo/templates/model.mak b/moksha/apps/helloworld/demo/templates/model.mak
new file mode 100644
index 0000000..af50fed
--- /dev/null
+++ b/moksha/apps/helloworld/demo/templates/model.mak
@@ -0,0 +1,7 @@
+<h1>Entries in the HelloWorld model</h1>
+
+<ul>
+ % for entry in entries[::-1]:
+ <li>${str(entry.id)} - ${entry.message} - ${str(entry.timestamp)}</li>
+ % endfor
+</ul>
diff --git a/moksha/apps/helloworld/demo/templates/template.mak b/moksha/apps/helloworld/demo/templates/template.mak
new file mode 100644
index 0000000..2010e44
--- /dev/null
+++ b/moksha/apps/helloworld/demo/templates/template.mak
@@ -0,0 +1,8 @@
+<html>
+ <head>
+ <title>${msg}</title>
+ </head>
+ <body>
+ ${msg}
+ </body>
+</html>
diff --git a/moksha/apps/helloworld/demo/widgets/__init__.py b/moksha/apps/helloworld/demo/widgets/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/moksha/apps/helloworld/demo/widgets/basic.py b/moksha/apps/helloworld/demo/widgets/basic.py
new file mode 100644
index 0000000..7b7e48a
--- /dev/null
+++ b/moksha/apps/helloworld/demo/widgets/basic.py
@@ -0,0 +1,11 @@
+from tw.api import Widget
+
+class HelloWorldWidget(Widget):
+ params = ['msg']
+ msg = 'Hello World'
+ template = '${msg}'
+ engine_name = 'mako'
+
+ def update_params(self, d):
+ """ Render-time logic """
+ super(HelloWorldWidget, self).update_params(d)
diff --git a/moksha/apps/helloworld/demo/widgets/live.py b/moksha/apps/helloworld/demo/widgets/live.py
new file mode 100644
index 0000000..d77e974
--- /dev/null
+++ b/moksha/apps/helloworld/demo/widgets/live.py
@@ -0,0 +1,23 @@
+from moksha.api.widgets.live import LiveWidget
+
+class HelloWorldWidget(LiveWidget):
+ topic = "helloworld"
+ template = """
+ <b>Hello World Widget</b>
+ <form onsubmit="return send_msg()">
+ <input name="text" id="text"/>
+ </form>
+
+ <ul id="data"/>
+
+ <script>
+ function send_msg() {
+ moksha.send_message('helloworld', {'msg': $('#text').val()});
+ $('#text').val('');
+ return false;
+ }
+ </script>
+ """
+ onmessage = """
+ $('<li/>').text(json.msg).prependTo('#data');
+ """
diff --git a/moksha/apps/helloworld/setup.py b/moksha/apps/helloworld/setup.py
new file mode 100644
index 0000000..03e57d8
--- /dev/null
+++ b/moksha/apps/helloworld/setup.py
@@ -0,0 +1,35 @@
+from setuptools import setup, find_packages
+
+setup(
+ name='moksha.demo',
+ version='0.1',
+ description='A Hello World Moksha app',
+ author='Luke Macken',
+ author_email='lmacken(a)redhat.com',
+ url='http://moksha.fedorahosted.org',
+ license='GPLv3+',
+ install_requires=['Moksha'],
+ packages=find_packages(),
+ include_package_data=True,
+ test_suite='nose.collector',
+
+ entry_points="""
+
+ [moksha.root]
+ root = demo.controllers.root:Root
+
+ [moksha.application]
+ helloworld = demo.controllers.root:Root
+
+ [moksha.producer]
+ helloworld = demo.producer:HelloWorldProducer
+
+ [moksha.consumer]
+ helloworld = demo.consumer:HelloWorldConsumer
+
+ [moksha.widget]
+ basic = demo.widgets.basic:HelloWorldWidget
+ live = demo.widgets.live:HelloWorldWidget
+
+ """
+)
13 years, 6 months
moksha/templates
by Luke Macken
moksha/templates/moksha/livewidget/moksha/widgets/+package+/widgets.py_tmpl | 2 ++
1 file changed, 2 insertions(+)
New commits:
commit 9fcab854e0da3bf84e3d6f92010dc27a02b67a07
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Dec 16 15:44:57 2010 -0500
Have our livewidget quickstart pull in moksha_js
diff --git a/moksha/templates/moksha/livewidget/moksha/widgets/+package+/widgets.py_tmpl b/moksha/templates/moksha/livewidget/moksha/widgets/+package+/widgets.py_tmpl
index 09f887e..fe33f6f 100644
--- a/moksha/templates/moksha/livewidget/moksha/widgets/+package+/widgets.py_tmpl
+++ b/moksha/templates/moksha/livewidget/moksha/widgets/+package+/widgets.py_tmpl
@@ -1,4 +1,5 @@
from moksha.api.widgets.live import LiveWidget
+from moksha.widgets.moksha_js import moksha_js
class {{widget_name}}(LiveWidget):
topic = '{{topic}}'
@@ -7,6 +8,7 @@ class {{widget_name}}(LiveWidget):
$('#chat_${id}').val(json.name + ': ' + json.message +
$('#chat_${id}').val())
"""
+ javascript = [moksha_js]
template = 'mako:moksha.widgets.{{package}}.templates.widget'
def update_params(self, d):
13 years, 6 months
moksha/controllers
by Luke Macken
moksha/controllers/root.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit 91612f8ef9c86d9fc611a3a618889338a4701e27
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Dec 16 15:26:56 2010 -0500
Trivial formatting tweak
diff --git a/moksha/controllers/root.py b/moksha/controllers/root.py
index fc767bd..79eaf18 100644
--- a/moksha/controllers/root.py
+++ b/moksha/controllers/root.py
@@ -62,7 +62,9 @@ class RootController(BaseController):
"""Returns a raw Moksha live socket, for use in non-Moksha apps.
<script> function bar(msg) { alert('bar(' + msg + ')'); } </script>
- <script type="text/javascript" src="http://localhost:8080/livesocket?topic=foo&callback=bar"> </script>
+ <script type="text/javascript"
+ src="http://localhost:8080/livesocket?topic=foo&callback=bar">
+ </script>
"""
data = {'topic': topic, 'callback': callback}
13 years, 6 months
docs/main
by Luke Macken
docs/main/QuickstartTemplates.rst | 9 +++++++++
1 file changed, 9 insertions(+)
New commits:
commit 3e17992f89a371e7d162938856cb2dbe3451b769
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Dec 16 11:51:59 2010 -0500
Add instructions for running your quickstarted app using the moksha CLI
diff --git a/docs/main/QuickstartTemplates.rst b/docs/main/QuickstartTemplates.rst
index 9d9ac11..928ec8a 100644
--- a/docs/main/QuickstartTemplates.rst
+++ b/docs/main/QuickstartTemplates.rst
@@ -36,6 +36,15 @@ Creating a new moksha app with all components
$ paster moksha --livewidget --producer --consumer --controller
+Quick and dirty method of running your app
+------------------------------------------
+
+This command will run the entire Moksha stack, including orbited, paster WSGI
+server, and the moksha-hub, along with your application.
+
+.. code-block:: bash
+
+ $ moksha start
Creating and installing an RPM for your new package
---------------------------------------------------
13 years, 6 months