moksha/lib
by Luke Macken
moksha/lib/helpers.py | 5 -----
1 file changed, 5 deletions(-)
New commits:
commit d2762077e28b65d7ebd82b5fedba326b9b94d1b6
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Feb 17 15:18:52 2009 -0500
Remove some debugging statements from our cache_rendered decorator
diff --git a/moksha/lib/helpers.py b/moksha/lib/helpers.py
index fefaf6f..4dd070d 100644
--- a/moksha/lib/helpers.py
+++ b/moksha/lib/helpers.py
@@ -510,13 +510,8 @@ def cache_rendered_data(data):
@decorator
def cache_rendered(func, *args, **kwargs):
- print "cache_rendered"
- raise Exception
content = func(*args, **kwargs)
- print "wrapper. content = %r" % content
if pylons.g.cache and \
pylons.request.environ.get('HTTP_X_FORWARDED_PROTO'):
pylons.g.cache.set(pylons.request.path_qs, str(content))
- print "cache_rendered(%r)" % str(content)
- else: print "Not caching rendered!"
return content
15 years, 4 months
feeds.txt
by Luke Macken
feeds.txt | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 100 insertions(+)
New commits:
commit 36ce45b93f63200af12591e05b1e0707576798d7
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Feb 17 15:16:21 2009 -0500
Add our list of 100 rss feeds for Feed Streamer testing
diff --git a/feeds.txt b/feeds.txt
new file mode 100644
index 0000000..856923d
--- /dev/null
+++ b/feeds.txt
@@ -0,0 +1,100 @@
+http://www.scripting.com/rss.xml
+http://www.csmonitor.com/rss/top.rss
+http://productnews.userland.com/newsItems/departments/radioUserland.xml
+http://rss.news.yahoo.com/rss/tech
+http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml
+http://www.nytimes.com/services/xml/rss/nyt/Business.xml
+http://www.nytimes.com/services/xml/rss/nyt/Health.xml
+http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml
+http://www.nytimes.com/services/xml/rss/nyt/Sports.xml
+http://www.wired.com/news_drop/netcenter/netcenter.rdf
+http://news.com.com/2547-1_3-0-5.xml
+http://www.fool.com/xml/foolnews_rss091.xml
+http://www.washingtonpost.com/wp-srv/business/rssheadlines.xml
+http://www.washingtonpost.com/wp-srv/technology/rssheadlines.xml
+http://www.dictionary.com/wordoftheday/wotd.rss
+http://static.userland.com/tomalak/links2.xml
+http://www.infoworld.com/rss/news.xml
+http://rss.cnn.com/rss/edition.rss
+http://www.theregister.co.uk/tonys/slashdot.rdf
+http://feeds.fool.com/usmf/foolwatch
+http://radio.weblogs.com/0001011/rss.xml
+http://www.nytimes.com/services/xml/rss/nyt/Technology.xml
+http://www.computerworld.com/news/xml/10/0,5009,,00.xml
+http://www.washingtonpost.com/wp-srv/politics/rssheadlines.xml
+http://live.curry.com/rss.xml
+http://www.washingtonpost.com/wp-srv/nation/columns/kurtzhoward/rssheadlines.xml
+http://www.washingtonpost.com/wp-srv/politics/elections/2004/rnc/dispatches/rssheadlines.xml
+http://news.cnet.com/2547-1_3-0-5.xml
+http://www.washingtonpost.com/wp-dyn/rss/technology/index.xml
+http://www.washingtonpost.com/wp-dyn/rss/business/index.xml
+http://www.cadenhead.org/workbench/rss
+http://feeds.computerworld.com/Computerworld/News
+http://www.cadenhead.org/workbench/rss.xml
+http://www.nytimes.com/services/xml/rss/userland/Technology.xml
+http://wmf.editthispage.com/xml/scriptingNews2.xml
+http://www.nytimes.com/services/xml/rss/userland/HomePage.xml
+http://radio.weblogs.com/0001015/categories/radioUserland/rss.xml
+http://www.infoworld.com/rss/news.rdf
+http://www.news.com/2547-1_3-0-5.xml
+http://www.nytimes.com/services/xml/rss/userland/Business.xml
+http://www.nytimes.com/services/xml/rss/userland/Health.xml
+http://export.cnet.com/export/feeds/news/rss/1,11176,,00.xml
+http://dictionary.reference.com/wordoftheday/wotd.rss
+http://partners.userland.com/nytRss/technology.xml
+http://www.theregister.co.uk/headlines.rss
+http://www.nytimes.com/services/xml/rss/userland/Sports.xml
+http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss091.xml
+http://www.nytimes.com/services/xml/rss/userland/Education.xml
+http://boingboing.net/rss.xml
+http://weblog.infoworld.com/udell/rss.xml
+http://partners.userland.com/nytRss/nytHomepage.xml
+http://www.theshiftedlibrarian.com/rss.xml
+http://partners.userland.com/nytRss/education.xml
+http://partners.userland.com/nytRss/business.xml
+http://www.wired.com//rss/index.xml
+http://www.kuro5hin.org/backend.rdf
+http://www.bbc.co.uk/syndication/feeds/news/ukfs_news/front_page/rss091.xml
+http://partners.userland.com/people/docSearls.xml
+http://newsrss.bbc.co.uk//rss/newsonline_uk_edition/front_page/rss.xml
+http://www.quotationspage.com/data/qotd.rss
+http://www.tidbits.com/channels/tidbits.rss
+http://www.bbc.co.uk/syndication/feeds/news/ukfs_news/technology/rss091.xml
+http://xml.newsisfree.com/feeds/39/1439.xml
+http://partners.userland.com/nytRss/health.xml
+http://www.salon.com/feed/RDF/salon_use.rdf
+http://www.joelonsoftware.com/rss.xml
+http://slashdot.org/slashdot.rdf
+http://scriptingnews.userland.com/xml/scriptingNews2.xml
+http://jrobb.mindplex.org/rss.xml
+http://www.webreference.com/webreference.rdf
+http://partners.userland.com/nytRss/sports.xml
+http://productnews.userland.com/xml/rss.xml
+http://80211b.weblogger.com/xml/scriptingNews2.xml
+http://www.macnn.com/macnn.rdf
+http://www.dpreview.com/news/dpr.rdf
+http://www.ozzie.net/blog/rss.xml
+http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml
+http://www.inessential.com/xml/rss.xml
+http://updatelogs.userland.com/Radio.xml
+http://rss.slashdot.org/Slashdot/slashdot/to
+http://static.userland.com/updatelogs/Radio.xml
+http://www.spacetoday.net/summaries.rdf
+http://news.bbc.co.uk/rss/newsonline_uk_edition/technology/rss.xml
+http://frontier.userland.com/xml/rss.xml
+http://www.quotationspage.com/data/mqotd.rss
+http://www.guardian.co.uk/rss/1,,,00.xml
+http://radio.weblogs.com/0104487/rss.xml
+http://www.windley.com/rss.xml
+http://xml.metafilter.com/rss.xml
+http://www.cadenhead.org/workbench/atom
+http://wmf.editthispage.com/xml/rss.xml
+http://www.nytimes.com/services/xml/rss/userland/Science.xml
+http://www.morons.org/morons.rss
+http://ranchero.com/xml/rss.xml
+http://jrobb.userland.com/rss.xml
+http://feeds.cadenhead.org/workbench
+http://weblog.siliconvalley.com/column/dangillmor/index.rdf
+http://paolo.evectors.it/rss.xml
+http://newsrss.bbc.co.uk//rss/newsonline_uk_edition/technology/rss.xml
+http://lewk.org/rss
15 years, 4 months
2 commits - development.ini moksha/controllers moksha/exc.py moksha/lib moksha/widgetbrowser moksha/wsgiapp.py setup.py start-moksha stop-moksha
by Luke Macken
development.ini | 5 +-
moksha/controllers/root.py | 10 +++--
moksha/exc.py | 3 +
moksha/lib/app_globals.py | 18 +++++++++
moksha/lib/cache.py | 20 +++++++++++
moksha/lib/helpers.py | 47 ++++++++++++++++++++++----
moksha/widgetbrowser/widgetbrowser/wsgiapp.py | 7 +++
moksha/wsgiapp.py | 2 -
setup.py | 2 -
start-moksha | 7 +++
stop-moksha | 3 +
11 files changed, 109 insertions(+), 15 deletions(-)
New commits:
commit c3a1d0f69176efd73192566bc37cac04444d36ff
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 15:16:02 2009 -0500
Add a memcached-specific cache object for our cache_rendered{,_data} decorators
diff --git a/moksha/lib/app_globals.py b/moksha/lib/app_globals.py
index 63dcbce..230c024 100644
--- a/moksha/lib/app_globals.py
+++ b/moksha/lib/app_globals.py
@@ -24,7 +24,6 @@ class Globals(object):
timeout = int(config.get('beaker.cache.timeout', '0'))
try:
self.cache = Cache(config['beaker.cache.url'], timeout)
- #self.cache = Shove('memcache://%s' % config['beaker.cache.url'])
except CacheBackendException, e:
log.warning(str(e))
self.cache = None
diff --git a/moksha/lib/cache.py b/moksha/lib/cache.py
new file mode 100644
index 0000000..20536c1
--- /dev/null
+++ b/moksha/lib/cache.py
@@ -0,0 +1,20 @@
+import memcache
+from moksha.exc import CacheBackendException
+
+class Cache(object):
+ """ A memcached-specific caching interface """
+
+ def __init__(self, url, timeout=None, prefix=None):
+ self.mc = memcache.Client([url])
+ self.timeout = timeout or 300
+ self.prefix = prefix
+ if not self.mc.set('x', 'x', 1):
+ raise CacheBackendException("Cannot connect to Memcached")
+
+ def get(self, key):
+ return self.mc.get(key)
+
+ def set(self, key, value, timeout=None):
+ if self.prefix:
+ key = self.prefix + key
+ self.mc.set(key, value, timeout or self.timeout)
commit df367d6183408ca3fee3dbeaf03200b6dfccee7f
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 13:21:10 2009 -0500
Add a cache_rendered and cache_rendered_data methods to the moksha
helpers module
diff --git a/development.ini b/development.ini
index 4fa8376..21eba0d 100644
--- a/development.ini
+++ b/development.ini
@@ -75,8 +75,9 @@ cache_dir = %(here)s/data
beaker.session.key = moksha
beaker.session.secret = somesecret
-beaker.cache.type = memory
-#beaker.cache.type = memcached
+#beaker.cache.type = memory
+beaker.cache.type = ext:memcached
+beaker.cache.url = localhost:11211
# If you'd like to fine-tune the individual locations of the cache data dirs
# for the Cache data, or the Session saves, un-comment the desired settings
diff --git a/moksha/controllers/root.py b/moksha/controllers/root.py
index 90dc1a9..1bcffde 100644
--- a/moksha/controllers/root.py
+++ b/moksha/controllers/root.py
@@ -17,10 +17,14 @@
# Authors: Luke Macken <lmacken(a)redhat.com>
import moksha
+import pylons
+import os
from tg import config
from tg import expose, flash, require, tmpl_context, redirect, validate
from tg.controllers import WSGIAppController
+from tg.decorators import after_render
+
from repoze.what import predicates
from pkg_resources import resource_filename
from widgetbrowser import WidgetBrowser
@@ -28,22 +32,21 @@ from widgetbrowser import WidgetBrowser
from moksha import _
from moksha.model import DBSession
from moksha.lib.base import BaseController
+from moksha.lib.helpers import cache_rendered_data
from moksha.exc import ApplicationNotFound
from moksha.controllers.error import ErrorController
from moksha.controllers.apps import AppController
from moksha.controllers.widgets import WidgetController
-#from moksha.controllers.secc import AdminController
# So we can mount the WidgetBrowser as /docs
-import os
os.environ['TW_BROWSER_PREFIX'] = '/docs'
+
class RootController(BaseController):
appz = AppController()
widgets = WidgetController()
error = ErrorController()
- #admin = AdminController()
# ToscaWidgets WidgetBrowser integration
docs = WSGIAppController(
@@ -53,6 +56,7 @@ class RootController(BaseController):
docs_dir=config.get('docs_dir', 'docs'),
full_stack=False))
+ @after_render(cache_rendered_data)
@expose('mako:moksha.templates.index')
def index(self):
tmpl_context.menu_widget = moksha.menus['default_menu']
diff --git a/moksha/exc.py b/moksha/exc.py
index 152d9d2..442f131 100644
--- a/moksha/exc.py
+++ b/moksha/exc.py
@@ -25,3 +25,6 @@ class ApplicationNotFound(MokshaException):
class WidgetNotFound(MokshaException):
pass
+
+class CacheBackendException(MokshaException):
+ pass
diff --git a/moksha/lib/app_globals.py b/moksha/lib/app_globals.py
index 342c8cb..63dcbce 100644
--- a/moksha/lib/app_globals.py
+++ b/moksha/lib/app_globals.py
@@ -1,5 +1,16 @@
"""The application's Globals object"""
+import logging
+
+from tg import config
+from shove import Shove
+
+from moksha.exc import CacheBackendException
+from moksha.lib.cache import Cache
+
+
+log = logging.getLogger(__name__)
+
class Globals(object):
"""Globals acts as a container for objects available throughout the
life of the application
@@ -10,4 +21,10 @@ class Globals(object):
initialization and is available during requests via the 'g'
variable
"""
- pass
+ timeout = int(config.get('beaker.cache.timeout', '0'))
+ try:
+ self.cache = Cache(config['beaker.cache.url'], timeout)
+ #self.cache = Shove('memcache://%s' % config['beaker.cache.url'])
+ except CacheBackendException, e:
+ log.warning(str(e))
+ self.cache = None
diff --git a/moksha/lib/helpers.py b/moksha/lib/helpers.py
index 4dc88b3..fefaf6f 100644
--- a/moksha/lib/helpers.py
+++ b/moksha/lib/helpers.py
@@ -1,3 +1,9 @@
+import moksha
+import pylons
+import uuid
+import simplejson as json
+import re
+
from webhelpers import date, feedgenerator, html, number, misc, text
from repoze.what.predicates import (Not, Predicate, All, Any, has_all_permissions,
@@ -9,13 +15,8 @@ from repoze.what.authorize import check_authorization, NotAuthorizedError
from webob import Request
-import urllib
-import uuid
-import simplejson as json
-import re
-
from decorator import decorator
-import moksha
+
scrub_filter = re.compile('[^_a-zA-Z0-9-]')
@@ -485,3 +486,37 @@ except:
def __repr__(self):
return 'defaultdict(%s, %s)' % (self.default_factory,
dict.__repr__(self))
+
+
+# TODO: document this
+def cache_rendered_data(data):
+ """ A method to cache ``data`` with the current request path as the key.
+
+ This method can be used within TurboGears2 hooks to cache rendered data
+ from a given method for a specific URL. For example, to cache the
+ index.html, you could do something like this::
+
+ from tg.decorators import after_render
+
+ @after_render(cache_rendered_data)
+ @expose('mako:moksha.templates.index')
+ def index(self):
+ return dict()
+
+ This is best utilized in conjunction with Nginx and Memcached.
+ """
+ if pylons.g.cache and pylons.request.environ.get('HTTP_X_FORWARDED_PROTO'):
+ pylons.g.cache.set(pylons.request.path_qs, str(data))
+
+@decorator
+def cache_rendered(func, *args, **kwargs):
+ print "cache_rendered"
+ raise Exception
+ content = func(*args, **kwargs)
+ print "wrapper. content = %r" % content
+ if pylons.g.cache and \
+ pylons.request.environ.get('HTTP_X_FORWARDED_PROTO'):
+ pylons.g.cache.set(pylons.request.path_qs, str(content))
+ print "cache_rendered(%r)" % str(content)
+ else: print "Not caching rendered!"
+ return content
diff --git a/moksha/widgetbrowser/widgetbrowser/wsgiapp.py b/moksha/widgetbrowser/widgetbrowser/wsgiapp.py
index 600d8b2..ec12764 100644
--- a/moksha/widgetbrowser/widgetbrowser/wsgiapp.py
+++ b/moksha/widgetbrowser/widgetbrowser/wsgiapp.py
@@ -17,6 +17,8 @@ try:
except ImportError:
have_formencode = False
+from moksha.lib.helpers import cache_rendered
+
__all__ = ['WidgetBrowser']
log = logging.getLogger(__name__)
@@ -119,6 +121,7 @@ class WidgetBrowser(object):
def __call__(self, environ, start_response):
return self.app(environ, start_response)
+ @cache_rendered
def app(self, environ, start_response):
req = Request(environ)
resp = Response(request=req, content_type='text/html; charset=utf-8')
@@ -198,6 +201,7 @@ class WidgetBrowser(object):
widget = req.widget
return self.render('widget_index.html', locals())
+ @cache_rendered
def show_demo(self, req, resp):
widget = req.widget
widget_name = widget.__class__.__name__
@@ -215,7 +219,10 @@ class WidgetBrowser(object):
_disp = req.GET.get('_disp', '')
else:
_disp = ''
+
widget_output = util.display_widget(widget, _disp, self.context)
+
+ # Wrap non-genshi things, like Mako based widgets, in a Genshi Markup object
if not callable(widget_output):
widget_output = Markup(widget_output)
diff --git a/moksha/wsgiapp.py b/moksha/wsgiapp.py
index 5003877..2fee60c 100644
--- a/moksha/wsgiapp.py
+++ b/moksha/wsgiapp.py
@@ -18,8 +18,6 @@
from pylons.wsgiapp import PylonsApp
-import moksha
-
class MokshaAppDispatcher(PylonsApp):
""" Moksha WSGI Application Dispatcher.
diff --git a/setup.py b/setup.py
index 7aa603d..0d08282 100644
--- a/setup.py
+++ b/setup.py
@@ -51,7 +51,7 @@ setup(
[moksha.stream]
demo = moksha.streams.demo:MokshaDemoDataStream
#livegraph = moksha.examples.livegraph:LiveGraphDataStream
- #feed = moksha.streams.feed:FeedStream
+ feed = moksha.streams.feed:FeedStream
#[moksha.consumer]
#moksha = moksha.hub.hub:MokshaConsumer
diff --git a/start-moksha b/start-moksha
index 33c0461..269bf9d 100755
--- a/start-moksha
+++ b/start-moksha
@@ -23,11 +23,18 @@ python setup.py develop
echo "Starting Moksha..."
+echo "Starting the WSGI stack..."
paster serve development.ini &
echo $! > paster.pid
+echo "Starting Orbited..."
orbited &
echo $! > orbited.pid
+echo "Starting the Moksha Hub..."
python moksha/hub/hub.py -v &
echo $! > hub.pid
+
+#echo "Starting memcached..."
+#memcached &
+#echo $! > memcached.pid
diff --git a/stop-moksha b/stop-moksha
index 3e32a25..9c0ce08 100755
--- a/stop-moksha
+++ b/stop-moksha
@@ -8,4 +8,7 @@ fi
if [ -f hub.pid ]; then
kill $(cat hub.pid)
fi
+if [ -f memcached.pid ]; then
+ kill $(cat memcached.pid)
+fi
rm -f *.pid
15 years, 4 months
3 commits - moksha/api moksha/lib moksha/public
by John (J5) Palmieri
moksha/api/widgets/containers/templates/layout_applist.mak | 28 +++++++
moksha/lib/helpers.py | 50 ++++++++++---
moksha/public/javascript/ui/moksha.ui.tabs.js | 12 ++-
3 files changed, 77 insertions(+), 13 deletions(-)
New commits:
commit 066305521fee0c76f4a1c2567369dde97e4dbec9
Merge: 0df4849... c07ffc4...
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Mon Feb 16 13:18:47 2009 -0500
Merge branch 'master' of git+ssh://johnp@git.fedorahosted.org/git/moksha
commit 0df4849bf3448147b868fc0bf2490c92f0c3c96d
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Mon Feb 16 13:17:42 2009 -0500
fix how we check predicates and add a param_has_value predicate
diff --git a/moksha/lib/helpers.py b/moksha/lib/helpers.py
index f3c4586..4dc88b3 100644
--- a/moksha/lib/helpers.py
+++ b/moksha/lib/helpers.py
@@ -5,6 +5,10 @@ from repoze.what.predicates import (Not, Predicate, All, Any, has_all_permissio
in_all_groups, in_any_group, in_group,
is_user, not_anonymous)
+from repoze.what.authorize import check_authorization, NotAuthorizedError
+
+from webob import Request
+
import urllib
import uuid
import simplejson as json
@@ -318,6 +322,33 @@ class MokshaWidget(Widget):
content_id=content_id, params=params,
auth=auth)
+class param_has_value(Predicate):
+ """
+ Checks the parameters of the environment and return True if the
+ parameter specified holds a value
+ """
+ message = u'Parameter "%s(param)" is not set'
+
+ def __init__(self, param, empty_str_is_valid = False, **kwargs):
+ super(param_has_value, self).__init__(**kwargs)
+ self.param = param
+ self.empty_str_is_valid = empty_str_is_valid
+
+ def evaluate(self, environ, credentials):
+ req = Request(environ)
+ p = req.params.getall(self.param)
+
+ if not p:
+ return self.unmet(param = self.param)
+
+ p = p[0]
+ if p == None:
+ return self.unmet(param = self.param)
+
+ if not self.empty_str_is_valid and p == '':
+ return self.unmet(param = self.param)
+
+ return
# setup the dictionary of acceptable callables when eval'ing predicates from
# a configuration file - this makes up the keywords of the predicate
@@ -326,6 +357,7 @@ _safe_predicate_callables = {
'Not': Not,
'All': All,
'Any': Any,
+ 'param_has_value': param_has_value,
'has_all_permissions': has_all_permissions,
'has_any_permission': has_any_permission,
'has_permission': has_permission,
@@ -378,18 +410,16 @@ def check_predicates(predicates):
from pylons import request
- if(isinstance(predicates, list) or isinstance(predicates, tuple)):
- for p in predicates:
- if not p.eval_with_environ(request.environ):
- return False
- return True
-
-
- if(isinstance(predicates, Predicate)):
- return predicates.eval_with_environ(request.environ)
+ if(not(isinstance(predicates, list) or isinstance(predicates, tuple))):
+ predicates = (predicates,)
- return False
+ for p in predicates:
+ try:
+ check_authorization(p, request.environ)
+ except NotAuthorizedError, e:
+ return False
+ return True
def eval_and_check_predicates(predicate_str):
"""
commit e546a5faf5e44de686232b017207504bb6801de7
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Mon Feb 16 13:16:16 2009 -0500
strip javascript in containers
diff --git a/moksha/api/widgets/containers/templates/layout_applist.mak b/moksha/api/widgets/containers/templates/layout_applist.mak
index 8dc1fa6..d9d8a24 100644
--- a/moksha/api/widgets/containers/templates/layout_applist.mak
+++ b/moksha/api/widgets/containers/templates/layout_applist.mak
@@ -4,6 +4,22 @@
% if app['label']:
<dt>${app['label']}</dt>
% endif
+
+ <script type="text/javascript">
+ function moksha_strip_and_display(r, panel) {
+ var $temp = $(r);
+ var $scripts = $temp.find("script[src]");
+ $scripts.remove();
+
+ var $stripped = [];
+ $.each($temp, function(i, s) {
+ if (!$(s).is('script[src]')){
+ $stripped.push(s);
+ }
+ });
+ panel.html($stripped);
+ }
+ </script>
<dd id="${app['id']}">
% if app.has_key('widget'):
${app['widget'](**app['params'])}
@@ -12,7 +28,17 @@
% if not app.has_key('widget'):
<script type="text/javascript">
- $("#${app['id']}").load("${app['url']}", ${app['params']});
+ <!-- TODO: make this a JS widget -->
+ var ajaxOptions = {
+ url: "${app['url']}",
+ success: function(r, s) {
+ var $panel = $("#${app['id']}");
+ moksha_strip_and_display(r, $panel);
+ },
+ data: ${app['params']}
+ };
+
+ $.ajax(ajaxOptions);
</script>
% endif
diff --git a/moksha/public/javascript/ui/moksha.ui.tabs.js b/moksha/public/javascript/ui/moksha.ui.tabs.js
index 5208344..406a2ac 100644
--- a/moksha/public/javascript/ui/moksha.ui.tabs.js
+++ b/moksha/public/javascript/ui/moksha.ui.tabs.js
@@ -532,9 +532,17 @@ $.widget("ui.mokshatabs", {
url: url,
success: function(r, s) {
var $panel = $(a.hash + ':first', self.element);
- $panel.html(r);
+ var $temp = $(r);
+ var $stripped = [];
+ $.each($temp, function(i, s) {
+ if (!$(s).is('script[src]')){
+ $stripped.push(s);
+ }
+ });
+ $panel.html($stripped);
cleanup();
+
if (o.cache)
$.data(a, 'cache.tabs', true); // if loaded once do not load them again
@@ -542,7 +550,7 @@ $.widget("ui.mokshatabs", {
$(self.element).triggerHandler('tabsload',
[self.fakeEvent('tabsload'), self.ui(self.$tabs[index], self.$panels[index])], o.load
);
- o.ajaxOptions.success && o.ajaxOptions.success(r, s);
+ o.ajaxOptions.success && o.ajaxOptions.success($temp, s);
// This callback is required because the switch has to take
// place after loading has completed. Call last in order to
15 years, 4 months
docs/_templates
by Luke Macken
docs/_templates/indexcontent.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit c07ffc40003ddbb1803d8da847daa657cff83738
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:48:26 2009 -0500
Minor doc tweak
diff --git a/docs/_templates/indexcontent.html b/docs/_templates/indexcontent.html
index 38a630d..43648de 100644
--- a/docs/_templates/indexcontent.html
+++ b/docs/_templates/indexcontent.html
@@ -10,7 +10,7 @@
<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/Messaging") }}">Messaging</a><br/>
- <span class="linkdescr">Information on Moksha's real-time messaging layer</span></p>
+ <span class="linkdescr">Moksha's real-time messaging layer</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>
</td><td width="50%">
15 years, 4 months
nginx/moksha.conf
by Luke Macken
nginx/moksha.conf | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
New commits:
commit d60b86a58043062e644aff0e7244c4915400a83a
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:30:59 2009 -0500
Add a default Nginx Moksha configuration
diff --git a/nginx/moksha.conf b/nginx/moksha.conf
new file mode 100644
index 0000000..694356d
--- /dev/null
+++ b/nginx/moksha.conf
@@ -0,0 +1,39 @@
+upstream backend {
+ server 127.0.0.1:5000;
+ server 127.0.0.1:5001;
+ server 127.0.0.1:5002;
+ server 127.0.0.1:5003;
+}
+
+server {
+ listen 80;
+ location / {
+ #ssi on;
+ proxy_set_header X_FORWARDED_PROTO $scheme;
+ proxy_set_header X_FORWARDED_HOST $host;
+ proxy_set_header X_FORWARDED_FOR $remote_addr;
+
+ if ($request_method != GET) {
+ proxy_pass http://backend;
+ }
+
+ set $memcached_key $request_uri;
+
+ memcached_pass localhost:11211;
+
+ default_type text/html;
+ error_page 404 502 = /dynamic;
+ }
+
+ location /dynamic {
+ #ssi on;
+ proxy_set_header X_FORWARDED_PROTO $scheme;
+ proxy_set_header X_FORWARDED_HOST $host;
+ proxy_set_header X_FORWARDED_FOR $remote_addr;
+ proxy_pass http://backend;
+ }
+
+}
+
+
+
15 years, 4 months
2 commits - docs/_templates moksha/api start-moksha
by Luke Macken
docs/_templates/indexcontent.html | 4 ++--
moksha/api/widgets/feed/feed.py | 31 ++-----------------------------
start-moksha | 1 +
3 files changed, 5 insertions(+), 31 deletions(-)
New commits:
commit 58eaef45e250dda2a378c2aac67e50cbfb221d36
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:29:14 2009 -0500
Ugh, hack around more setuptools nonsense
diff --git a/start-moksha b/start-moksha
index 1c46b53..33c0461 100755
--- a/start-moksha
+++ b/start-moksha
@@ -10,6 +10,7 @@ if [ ! $VIRTUAL_ENV ]; then
#virtualenv --no-site-packages tg2env
source tg2env/bin/activate
easy_install -U WebOb
+ easy_install -U SQLAlchemy
easy_install -i http://www.turbogears.org/2.0/downloads/current/index tg.devtools
pushd moksha/widgetbrowser; python setup.py develop; popd
easy_install "tw.jquery==dev"
commit 4b592a658555563c182cda329a4b4a6a4cccd1ff
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:28:49 2009 -0500
Some more documentation tweaks
diff --git a/docs/_templates/indexcontent.html b/docs/_templates/indexcontent.html
index 73cfca2..38a630d 100644
--- a/docs/_templates/indexcontent.html
+++ b/docs/_templates/indexcontent.html
@@ -30,10 +30,10 @@
<p><strong>Indices and tables:</strong></p>
<table class="contentstable" align="center"><tr>
<td width="50%">
- <p class="biglink"><a class="biglink" href="{{ pathto("modindex") }}">Global Module Index</a><br/>
- <span class="linkdescr">quick access to all modules</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">General Index</a><br/>
<span class="linkdescr">all functions, classes, terms</span></p>
+ <p class="biglink"><a class="biglink" href="{{ pathto("modindex") }}">Global Module Index</a><br/>
+ <span class="linkdescr">quick access to all modules</span></p>
</td><td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("search") }}">Search page</a><br/>
<span class="linkdescr">search this documentation</span></p>
diff --git a/moksha/api/widgets/feed/feed.py b/moksha/api/widgets/feed/feed.py
index b78337a..3818bc1 100644
--- a/moksha/api/widgets/feed/feed.py
+++ b/moksha/api/widgets/feed/feed.py
@@ -33,39 +33,12 @@ feed_storage = None
feed_cache = None
class Feed(Widget):
- """ A powerful Feed object.
+ """
+ The Moksha Feed object.
A Feed is initialized with an id and a url, and automatically handles the
fetching, parsing, and caching of the data.
- Ways of creating utilizing the Feed widget:
-
- 0) Specifying the URL render-time
-
- feed = Feed()
- feed(url='http://foo.com/feed.xml')
-
- 1) Subclassing
-
- class MyFeed(Feed):
- url = 'http://foo.com/feed.xml'
-
- myfeed = MyFeed()
- myfeed() # renders the widget, usually done in the template
-
- 2) As ToscaWidget children
-
- class MyWidget(Widget):
- myfeedurl = 'http://foo.com/feed.xml'
- children = [Feed('myfeed', url=myfeedurl)]
- template = "${c.myfeed()}"
-
- 3) As a generator
-
- feed = Feed(url='http://foo.com/feed.xml')
- for entry in feed.iterentries():
- print entry.title
-
"""
url = None
template = 'mako:moksha.api.widgets.feed.templates.feed_home'
15 years, 4 months
11 commits - docs/conf.py docs/contents.rst docs/copyright.rst docs/index.rst docs/license.rst docs/main docs/_templates moksha/api moksha/widgets
by Luke Macken
dev/null |binary
docs/_templates/indexcontent.html | 75 ++++
docs/conf.py | 25 +
docs/contents.rst | 18
docs/copyright.rst | 13
docs/index.rst | 37 +-
docs/license.rst | 685 ++++++++++++++++++++++++++++++++++++++
docs/main/Architecture.rst | 19 -
docs/main/Consumers.rst | 8
docs/main/Features.rst | 72 +++
docs/main/Feeds.rst | 43 +-
docs/main/GettingStarted.rst | 9
docs/main/Messaging.rst | 11
docs/main/Middleware.rst | 7
docs/main/MokshaApplications.rst | 4
docs/main/Vision.rst | 14
docs/main/Widgets.rst | 9
17 files changed, 988 insertions(+), 61 deletions(-)
New commits:
commit 1d6c4ec363010966a1ff66c415719a620978f60c
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:23:36 2009 -0500
Remove some lame Mac DS_Store files :(
diff --git a/moksha/api/menus/static/css/.DS_Store b/moksha/api/menus/static/css/.DS_Store
deleted file mode 100755
index 5008ddf..0000000
Binary files a/moksha/api/menus/static/css/.DS_Store and /dev/null differ
diff --git a/moksha/api/menus/static/images/.DS_Store b/moksha/api/menus/static/images/.DS_Store
deleted file mode 100644
index 5008ddf..0000000
Binary files a/moksha/api/menus/static/images/.DS_Store and /dev/null differ
diff --git a/moksha/widgets/container/static/css/elements/.DS_Store b/moksha/widgets/container/static/css/elements/.DS_Store
deleted file mode 100644
index 2cae975..0000000
Binary files a/moksha/widgets/container/static/css/elements/.DS_Store and /dev/null differ
diff --git a/moksha/widgets/container/static/css/elements/skindef/.DS_Store b/moksha/widgets/container/static/css/elements/skindef/.DS_Store
deleted file mode 100644
index 5008ddf..0000000
Binary files a/moksha/widgets/container/static/css/elements/skindef/.DS_Store and /dev/null differ
commit 5a6550107820fda4f8a4990ee56d01832931989b
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:23:15 2009 -0500
Improve our feed documentation
diff --git a/docs/main/Feeds.rst b/docs/main/Feeds.rst
index ccbe062..b6e7bdb 100644
--- a/docs/main/Feeds.rst
+++ b/docs/main/Feeds.rst
@@ -14,48 +14,47 @@ automatically use a local sqlite database cache.
The Moksha Feed Widget
----------------------
-.. code-block:: python
-
- from moksha.api.widgets.feed import Feed
+.. autoclass:: moksha.api.widgets.feed.Feed
+ :members:
.. widgetbrowser:: moksha.widgets.demos.FeedDemo
:tabs: demo, source, template
:size: large
+Using the Feed widget
+~~~~~~~~~~~~~~~~~~~~~
-API usage
----------
+.. code-block:: python
-The Feed object can be utilize in many ways.
+ from moksha.api.widgets.feed import Feed
+ feed = Feed('myfeed')
+ feed(url='http://lewk.org/rss')
Rendering a url with the Feed object
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
- from moksha.api.widgets.feed import Feed
feed = Feed('myfeed')
feed(url='http://lewk.org/rss')
-:Note: Usually you would instantiate a single Feed object somewhere in your project, and just call it with a `url` when rendering it in your templates.
+.. note::
+ Usually you would instantiate a single Feed object somewhere in your
+ project, and just call it with a `url` when rendering it in your templates.
Subclassing
~~~~~~~~~~~
-You can easily subclass the Feed widget and provide your own url.
-
.. code-block:: python
- from moksha.api.widgets.feed import Feed
-
class MyFeed(Feed):
url = 'http://foo.com/feed.xml'
- myfeed = MyFeed('myfeed')
- myfeed() # renders the widget. usually done in the template.
+ myfeed = MyFeed()
+ myfeed() # renders the widget, usually done in the template
-As a child Widget
-~~~~~~~~~~~~~~~~~
+As ToscaWidget children
+~~~~~~~~~~~~~~~~~~~~~~~
By defining your Feeds as children to a widget, ToscaWidgets will automatically
handle setting a unique id for your Feed object, as well as giving you the
@@ -74,13 +73,8 @@ ability access it in your template from the `c` context object.
As a generator
~~~~~~~~~~~~~~
-You can also utilize the Feed widget as a generator, giving you the ability
-to iterate over the entries as necessary.
-
.. code-block:: python
- from moksha.api.widgets.feed import Feed
-
feed = Feed('myfeed', url='http://foo.com/feed.xml')
print '%d entries' % feed.num_entries()
for entry in feed.iterentries():
@@ -105,4 +99,9 @@ Here is an example of using the feed cache to manually fetch a feed.
for entry in feed.entries:
print entry
-:Note: The moksha.feed_cache object is a :class:`paste.registry.StackedObjectProxy` instance, and is setup by the :class:`moksha.middleware.MokshaMiddleware` before each request reaches your application. Thus, it only works during requests and cannot be used without using the MokshaMiddleware.
+.. note::
+ The moksha.feed_cache object is a
+ :class:`paste.registry.StackedObjectProxy` instance, and is setup by the
+ :class:`moksha.middleware.MokshaMiddleware` before each request reaches
+ your application. Thus, it only works during requests and cannot be
+ used without using the MokshaMiddleware.
commit dedfdc9fd0ecdf7e3b2a4ef57b2093336140ef49
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:16:44 2009 -0500
Lots of documentation improvements and refactoring.
diff --git a/docs/index.rst b/docs/index.rst
index e41ef10..511db55 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -7,29 +7,28 @@ Moksha is a platform for creating live collaborative applications. It provides
a layer of cohesion and collaboration between existing applications, services,
and communities.
-The Vision
-----------
+** Link to wiki, tickets, mailing lists, etc...
+** be *the* homepage, let trac just be for tickets and wiki.
+
+:Homepage: http://moksha.fedorahosted.org
+:Demo Dashboard: http://65.49.60.166
+
+Vision
+------
.. toctree::
- :maxdepth: 1
+ :maxdepth: 2
- main/Introduction
- main/MokshaPlatform
- main/DataAggregation
- main/DataInterpretation
- main/DataPersistence
- main/DataVisualization
- main/Scalability
+ main/Vision
Architecture
------------
.. toctree::
- :maxdepth: 1
+ :maxdepth: 2
+
+ main/Architecture
- main/Features
- main/Technology
- main/Infrastructure
Getting Started
---------------
@@ -55,6 +54,7 @@ Messaging
.. toctree::
:maxdepth: 1
+ main/Messaging
main/MessageBrokers
main/Topics
main/Consumers
@@ -69,6 +69,7 @@ Widgets
main/Feeds
main/LiveWidget
main/MokshaContainerWidgets
+ main/Widgets
..
Model
-----
@@ -106,3 +107,11 @@ Third-party Documentation
* `TurboGears <http://turbogears.org/2.0/docs/index.html>`_
* `ToscaWidgets <http://toscawidgets.org/documentation>`_
* `SQLAlchemy <http://www.sqlalchemy.org/docs/05>`_
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
diff --git a/docs/main/Architecture.rst b/docs/main/Architecture.rst
index 0972325..53d72b8 100644
--- a/docs/main/Architecture.rst
+++ b/docs/main/Architecture.rst
@@ -1,12 +1,9 @@
-Architecture Goals
-==================
+Moksha Architecture
+===================
-- `WSGI <http://wsgi.org>`_ (`PEP 333 <http://www.python.org/dev/peps/pep-0333/>`_) compliant application and `middleware <http://www.wsgi.org/wsgi/Middleware_and_Utilities>`_ stack
-- A real-time messaging hub using the `Advanced Message Queuing Protocol (AMQP) <http://http://amqp.org/>`_
-- Highly-scalable `Orbited <http://orbited.org>`_ servers for asynchronous real-time web-browser<->server communication.
-- A powerful widget creation API that trivializes the creation of modular, scalable, reusable real-time widgets that can efficiently acquire data from a variety of sources.
-- A data aggregation layer that handles fetching feeds for the widgets, caching
- them, and sending them to Orbited, and via AMQP messages.
-- A resource layer that trivializes interacting with external services in an intelligent and efficient manner.
-- A self-scaling architecture that can adapt to a variety of infrastructure environments.
-- A highly-scalable plugin infrastructure that transparently handles initializing, dispatching, and manipulating applications and widgets -- allowing people to rapidly innovate without worrying about the under/over-lying software architecture.
+.. toctree::
+ :maxdepth: 2
+
+ Features
+ Technology
+ Infrastructure
diff --git a/docs/main/Consumers.rst b/docs/main/Consumers.rst
index 64eaaff..2f411d1 100644
--- a/docs/main/Consumers.rst
+++ b/docs/main/Consumers.rst
@@ -20,9 +20,11 @@ Creating
def consume(self, message):
print message
-:Note: The :class:`MokshaHub` currently executes each consumer in their own
- Thread, so be sure to employ thread-safety precausions when implementing
- your :class:`Consumer`.
+.. note::
+
+ The :class:`MokshaHub` currently executes each consumer in their own
+ Thread, so be sure to employ thread-safety precausions when implementing
+ your :class:`Consumer`.
Installing
----------
diff --git a/docs/main/Features.rst b/docs/main/Features.rst
index 256782a..8088b94 100644
--- a/docs/main/Features.rst
+++ b/docs/main/Features.rst
@@ -3,3 +3,75 @@ Moksha Features
===============
.. image:: ../_static/moksha-features.png
+
+WSGI Middleware Stack
+---------------------
+Moksha provides a `WSGI <http://wsgi.org>`_ (`PEP 333 <http://www.python.org/dev/peps/pep-0333/>`_) compliant application and `middleware <http://www.wsgi.org/wsgi/Middleware_and_Utilities>`_ stack
+
+Messaging Hub
+-------------
+
+Moksha provides a message hub that allows for other applications, services, or users to communicate over a low-latency topic-based publish/subscribe message bus. It's designed in such a way to facilitate a variety of different message flows, allowing for a combination of different message queueing brokers and protocols.
+
+Out of the box, Moksha utilizes `MorbidQ <http://www.morbidq.com/>`_, a lightweight message queue for bundled deployment, for it's message queueing needs. With a 1-line change to Moksha's configuration file, you can integrate it with an existing `AMQP <http://amqp.org/>`_ broker, such as `Qpid <http://incubator.apache.org/qpid/>`_ or `RabbitMQ <http://rabbitmq.com>`_.
+
+Low-latency Browser Socket
+--------------------------
+
+Moksha integrates with `Orbited <http://orbited.org>`_, a highly-scalable
+server that allows for asynchronous browser <-> server communication. Moksha
+then makes it simple to create LiveWidgets_ that can publish and subscribe to
+arbitrary message topics in the MokshaHub_. This allows for the creation of
+very rich live web applications.
+
+Plugin Infrastructure
+---------------------
+
+Moksha offers a highly-scalable plugin infrastructure that transparently
+handles initializing, dispatching, manipulating, and scaling applications and
+widgets -- allowing people to rapidly innovate without worrying about the
+over or under-lying software architecture.
+
+Widget Creation API
+-------------------
+
+`ToscaWidgets <http://toscawidgets.org>`_ provides a powerful API for creating
+reusable "Widgets", which are essentially just bundles of HTML, JavaScript,
+CSS, and render-time logic. The ToscaWidgets WSGI Middleware is also integrated
+into Moksha, which handles intelligently injecting Widget resources.
+
+Moksha also provides a variety of other Widgets, including a LiveWidget_ API
+for creating real-time message-driven widgets that can efficiently acquire data
+from a variety of sources.
+
+Resource Connectors
+-------------------
+
+Moksha offers a Resource Layer that trivializes interacting with external
+services in an intelligent and efficient manner.
+
+Highly Scalable Architecture
+----------------------------
+
+Moksha architecture is self-scaling and can adapt to a variety of
+infrastructure environments.
+
+Expert System
+--------------
+
+The MokshaHub_ gives you Expert System-like functionality by providing APIs for
+interacting with a variety of knowledge bases (SQLAlchemy models, Resource
+Connectors, Caches, Message Queues, etc), and can easily monitor and process
+incoming data. One could then easily build state-machines, inference engines,
+or even forward/backward-chaning rule-driven expert systems.
+
+Moksha also provides a simple yet powerful API for creating DataStreamers_ that
+can do basically anything at anytime. It allows for the easy scripting of
+periodic tasks such as fetching data, polling resources, warming caches,
+sending notifications, analyzing databases, etc. For example, Moksha provides
+a FeedStream_, that automatically handles fetching, parsing, caching, and
+sending notifications for all known feeds at a regular interval.
+
+These are loaded by the MokshaHub_, and are executed outside of the WSGI
+application stack, but they are still able to access the Database, Cache,
+MessageHub, etc.
diff --git a/docs/main/GettingStarted.rst b/docs/main/GettingStarted.rst
index 7fc7774..3a7371b 100644
--- a/docs/main/GettingStarted.rst
+++ b/docs/main/GettingStarted.rst
@@ -48,7 +48,10 @@ Starting Moksha
$ ./start-moksha
-:Note: This script takes care of setting up your TurboGears2 virtual environment the first time it is run. To drop into the virtualenv manually you can run `source tg2env/bin/activate` to enter it, and `deactivate` to leave it.
+.. note::
+ This script takes care of setting up your TurboGears2 virtual environment
+ the first time it is run. To drop into the virtualenv manually you can run
+ `source tg2env/bin/activate` to enter it, and `deactivate` to leave it.
Stopping Moksha
---------------
@@ -64,4 +67,6 @@ Now you can navigate your web browser to the following url:
`http://localhost:8080 <http://localhost:8080>`_
-:Note: Going to `127.0.0.1` will not work properly with the current Orbited setup, so you must make sure to go to `localhost`.
+.. note::
+ Going to `127.0.0.1` will not work properly with the current Orbited setup,
+ so you must make sure to go to `localhost`.
diff --git a/docs/main/Middleware.rst b/docs/main/Middleware.rst
index 93f9258..7d8d63e 100644
--- a/docs/main/Middleware.rst
+++ b/docs/main/Middleware.rst
@@ -39,4 +39,9 @@ how it looks in TurboGears2. If you're using Moksha as a stand-alone platform,
full_stack, **app_conf)
return app
-:Note: It currently requires to be wrapped in the `paste.registry <http://pythonpaste.org/modules/registry.html>`_ WSGI middleware. TurboGears2 allows us to easily insert middleware directly on top of the raw application, so we then have the ability to use the paste.registry, sessions, and caching.
+.. note::
+ It currently requires to be wrapped in the `paste.registry
+ <http://pythonpaste.org/modules/registry.html>`_ WSGI middleware.
+ TurboGears2 allows us to easily insert middleware directly on top of the raw
+ application, so we then have the ability to use the paste.registry,
+ sessions, and caching.
diff --git a/docs/main/MokshaApplications.rst b/docs/main/MokshaApplications.rst
index d6aa089..c58207a 100644
--- a/docs/main/MokshaApplications.rst
+++ b/docs/main/MokshaApplications.rst
@@ -1,5 +1,5 @@
-Moksha Plugins
-==============
+Moksha Applications
+===================
When the :class:`moksha.middleware.MokshaMiddleware` is loaded, it will
automatically load all applications and widgets from those entry points,
commit c9cdee9b664579bab93b9176874ddac961071c97
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:15:39 2009 -0500
Add an example intersphinx mapping to our Sphinx config
diff --git a/docs/conf.py b/docs/conf.py
index c4f62ad..2a70ec7 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -164,3 +164,9 @@ try:
extensions.append("widgetbrowser.sphinx_ext")
except:
print "Unable to import the `widgetbrowser`. Try doing `cd moksha/widgetbrowser; python setup.py develop` to install it."
+
+#
+# example configuration for intersphinx: refer to the python standard library.
+#
+#extensions.append('sphinx.ext.intersphinx')
+#intersphinx_mapping = {'http://docs.python.org/dev': none}
commit 4380e0c70f77f3be6ca46d86ad6c8ba247497723
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:15:09 2009 -0500
Update our Sphinx config to show the new index, module authors, and warn about the widgetbrowser
diff --git a/docs/conf.py b/docs/conf.py
index 4e2bb91..c4f62ad 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -65,7 +65,7 @@ today_fmt = '%B %d, %Y'
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
-#show_authors = False
+show_authors = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'default'
@@ -98,17 +98,21 @@ html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
-#html_use_smartypants = True
+html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
-#html_additional_pages = {}
+html_additional_pages = {
+ 'index': 'indexcontent.html',
+}
+
+#html_split_index = True
# If false, no module index is generated.
-#html_use_modindex = True
+html_use_modindex = True
# If true, the reST sources are included in the HTML build as _sources/<name>.
#html_copy_source = True
@@ -155,5 +159,8 @@ code_path = test_path = os.path.dirname(os.path.abspath(__file__)) + os.path.sep
#
# Enable the ToscaWidgets WidgetBrowser
#
-import widgetbrowser
-extensions.append("widgetbrowser.sphinx_ext")
+try:
+ import widgetbrowser
+ extensions.append("widgetbrowser.sphinx_ext")
+except:
+ print "Unable to import the `widgetbrowser`. Try doing `cd moksha/widgetbrowser; python setup.py develop` to install it."
commit d85bdb1525b6135fdfe760fce027046b242904a8
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:14:01 2009 -0500
Create a toctree for our widget documentation
diff --git a/docs/main/Widgets.rst b/docs/main/Widgets.rst
new file mode 100644
index 0000000..5ceb18a
--- /dev/null
+++ b/docs/main/Widgets.rst
@@ -0,0 +1,9 @@
+Widgets
+=======
+
+.. toctree::
+ :maxdepth: 2
+
+ Feeds
+ LiveWidget
+ MokshaContainerWidgets
commit 1d5fd2ece75583ca883d31d5c6407a83e379d6f8
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:13:48 2009 -0500
Create a toctree for our vision documentation
diff --git a/docs/main/Vision.rst b/docs/main/Vision.rst
new file mode 100644
index 0000000..b3b031c
--- /dev/null
+++ b/docs/main/Vision.rst
@@ -0,0 +1,14 @@
+The Vision
+----------
+
+.. toctree::
+ :maxdepth: 2
+
+ Introduction
+ MokshaPlatform
+ DataAggregation
+ DataInterpretation
+ DataPersistence
+ DataVisualization
+ Scalability
+
commit 97651d21ffe2f93963531de4bac4c96846862652
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:13:25 2009 -0500
Create a toc tree for our messaging docs
diff --git a/docs/main/Messaging.rst b/docs/main/Messaging.rst
new file mode 100644
index 0000000..194bbef
--- /dev/null
+++ b/docs/main/Messaging.rst
@@ -0,0 +1,11 @@
+Messaging
+=========
+
+.. toctree::
+ :maxdepth: 2
+
+ MessageBrokers
+ Topics
+ Consumers
+ DataStreams
+ MokshaHub
commit 3032b48d10b717162003392fb996705c20b100fd
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:13:05 2009 -0500
Add a new index layout for our documentation
diff --git a/docs/_templates/indexcontent.html b/docs/_templates/indexcontent.html
new file mode 100644
index 0000000..73cfca2
--- /dev/null
+++ b/docs/_templates/indexcontent.html
@@ -0,0 +1,75 @@
+{% extends "defindex.html" %}
+
+{% block tables %}
+ <table class="contentstable" align="center"><tr>
+ <td width="50%">
+ <p class="biglink"><a class="biglink" href="{{ pathto("main/Vision") }}">The Vision</a><br/>
+ <span class="linkdescr">High-level goals and concepts</span></p>
+ <p class="biglink"><a class="biglink" href="{{ pathto("main/Widgets") }}">Widgets</a><br/>
+ <span class="linkdescr">Details on creating Widgets</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/Messaging") }}">Messaging</a><br/>
+ <span class="linkdescr">Information on Moksha's real-time messaging layer</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>
+ </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/MokshaApplications") }}">Applications</a><br/>
+ <span class="linkdescr">Details on creating applications using Moksha</span></p>
+ <p class="biglink"><a class="biglink" href="{{ pathto("main/Development") }}">Development</a><br/>
+ <span class="linkdescr">A handbook for hacking on and with Moksha</span></p>
+ <p class="biglink"><a class="biglink" href="{{ pathto("main/Deployment") }}">Deployment</a><br/>
+ <span class="linkdescr">Recipies for efficiently deploying and scaling Moksha</span></p>
+ <p class="biglink"><a class="biglink" href="http://bit.ly/RICf">Demo Dashboard</a><br/>
+ <span class="linkdescr">A simple demo Moksha dashboard</span></p>
+ </td></tr>
+ </table>
+
+ <p><strong>Indices and tables:</strong></p>
+ <table class="contentstable" align="center"><tr>
+ <td width="50%">
+ <p class="biglink"><a class="biglink" href="{{ pathto("modindex") }}">Global Module Index</a><br/>
+ <span class="linkdescr">quick access to all modules</span></p>
+ <p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">General Index</a><br/>
+ <span class="linkdescr">all functions, classes, terms</span></p>
+ </td><td width="50%">
+ <p class="biglink"><a class="biglink" href="{{ pathto("search") }}">Search page</a><br/>
+ <span class="linkdescr">search this documentation</span></p>
+ <p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">Complete Table of Contents</a><br/>
+ <span class="linkdescr">lists all sections and subsections</span></p>
+ </td></tr>
+ </table>
+
+ <p><strong>Meta information:</strong></p>
+ <table class="contentstable" align="center"><tr>
+ <td width="50%">
+ <p class="biglink"><a class="biglink" href="https://fedorahosted.org/moksha/newticket">Reporting bugs</a></p>
+ </td>
+ <td width="50%">
+ <p class="biglink"><a class="biglink" href="https://fedorahosted.org/moksha/report/1">Active Tickets</a></p>
+ </td></tr>
+ <tr>
+ <td width="50%">
+ <p class="biglink"><a class="biglink" href="https://fedorahosted.org/moksha/timeline">Timeline</a></p>
+ </td>
+ <td width="50%">
+ <p class="biglink"><a class="biglink" href="https://fedorahosted.org/moksha/roadmap">Roadmap</a></p>
+ </td></tr>
+ <tr>
+ <td width="50%">
+ <p class="biglink"><a class="biglink" href="http://moksha.fedorahosted.org">Wiki</a></p>
+ </td>
+ <td width="50%">
+ <p class="biglink"><a class="biglink" href="https://fedorahosted.org/mailman/listinfo/moksha">Mailing List</a></p>
+ </td></tr>
+ <tr>
+ <td width="50%">
+ <p class="biglink"><a class="biglink" href="{{ pathto("license") }}">License</a></p>
+ </td>
+ <td width="50%">
+ <p class="biglink"><a class="biglink" href="{{ pathto("copyright") }}">Copyright</a></p>
+ </td></tr>
+ </table>
+{% endblock %}
commit dfb677e42fef5d39666fd708561e149be4b85f55
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:12:40 2009 -0500
Add our license and copyright to our docs
diff --git a/docs/copyright.rst b/docs/copyright.rst
new file mode 100644
index 0000000..a81eee5
--- /dev/null
+++ b/docs/copyright.rst
@@ -0,0 +1,13 @@
+*********
+Copyright
+*********
+
+
+Moksha and this documentation is:
+
+Copyright © 2008 Red Hat, Inc.
+
+-----
+
+See :ref:`license` for complete license and permissions information.
+
diff --git a/docs/license.rst b/docs/license.rst
new file mode 100644
index 0000000..03331d0
--- /dev/null
+++ b/docs/license.rst
@@ -0,0 +1,685 @@
+.. _license:
+
+License
+=======
+
+Moksha is licensed under the GPLv3.
+
+.. code-block:: none
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+ software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+ to take away your freedom to share and change the works. By contrast,
+ the GNU General Public License is intended to guarantee your freedom to
+ share and change all versions of a program--to make sure it remains free
+ software for all its users. We, the Free Software Foundation, use the
+ GNU General Public License for most of our software; it applies also to
+ any other work released this way by its authors. You can apply it to
+ your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+ price. Our General Public Licenses are designed to make sure that you
+ have the freedom to distribute copies of free software (and charge for
+ them if you wish), that you receive source code or can get it if you
+ want it, that you can change the software or use pieces of it in new
+ free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+ these rights or asking you to surrender the rights. Therefore, you have
+ certain responsibilities if you distribute copies of the software, or if
+ you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+ gratis or for a fee, you must pass on to the recipients the same
+ freedoms that you received. You must make sure that they, too, receive
+ or can get the source code. And you must show them these terms so they
+ know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+ (1) assert copyright on the software, and (2) offer you this License
+ giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+ that there is no warranty for this free software. For both users' and
+ authors' sake, the GPL requires that modified versions be marked as
+ changed, so that their problems will not be attributed erroneously to
+ authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+ modified versions of the software inside them, although the manufacturer
+ can do so. This is fundamentally incompatible with the aim of
+ protecting users' freedom to change the software. The systematic
+ pattern of such abuse occurs in the area of products for individuals to
+ use, which is precisely where it is most unacceptable. Therefore, we
+ have designed this version of the GPL to prohibit the practice for those
+ products. If such problems arise substantially in other domains, we
+ stand ready to extend this provision to those domains in future versions
+ of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+ States should not allow patents to restrict development and use of
+ software on general-purpose computers, but in those that do, we wish to
+ avoid the special danger that patents applied to a free program could
+ make it effectively proprietary. To prevent this, the GPL assures that
+ patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+ modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+ works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+ License. Each licensee is addressed as "you". "Licensees" and
+ "recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+ in a fashion requiring copyright permission, other than the making of an
+ exact copy. The resulting work is called a "modified version" of the
+ earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+ on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+ permission, would make you directly or secondarily liable for
+ infringement under applicable copyright law, except executing it on a
+ computer or modifying a private copy. Propagation includes copying,
+ distribution (with or without modification), making available to the
+ public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+ parties to make or receive copies. Mere interaction with a user through
+ a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+ to the extent that it includes a convenient and prominently visible
+ feature that (1) displays an appropriate copyright notice, and (2)
+ tells the user that there is no warranty for the work (except to the
+ extent that warranties are provided), that licensees may convey the
+ work under this License, and how to view a copy of this License. If
+ the interface presents a list of user commands or options, such as a
+ menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+ for making modifications to it. "Object code" means any non-source
+ form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+ standard defined by a recognized standards body, or, in the case of
+ interfaces specified for a particular programming language, one that
+ is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+ than the work as a whole, that (a) is included in the normal form of
+ packaging a Major Component, but which is not part of that Major
+ Component, and (b) serves only to enable use of the work with that
+ Major Component, or to implement a Standard Interface for which an
+ implementation is available to the public in source code form. A
+ "Major Component", in this context, means a major essential component
+ (kernel, window system, and so on) of the specific operating system
+ (if any) on which the executable work runs, or a compiler used to
+ produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+ the source code needed to generate, install, and (for an executable
+ work) run the object code and to modify the work, including scripts to
+ control those activities. However, it does not include the work's
+ System Libraries, or general-purpose tools or generally available free
+ programs which are used unmodified in performing those activities but
+ which are not part of the work. For example, Corresponding Source
+ includes interface definition files associated with source files for
+ the work, and the source code for shared libraries and dynamically
+ linked subprograms that the work is specifically designed to require,
+ such as by intimate data communication or control flow between those
+ subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+ can regenerate automatically from other parts of the Corresponding
+ Source.
+
+ The Corresponding Source for a work in source code form is that
+ same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+ copyright on the Program, and are irrevocable provided the stated
+ conditions are met. This License explicitly affirms your unlimited
+ permission to run the unmodified Program. The output from running a
+ covered work is covered by this License only if the output, given its
+ content, constitutes a covered work. This License acknowledges your
+ rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+ convey, without conditions so long as your license otherwise remains
+ in force. You may convey covered works to others for the sole purpose
+ of having them make modifications exclusively for you, or provide you
+ with facilities for running those works, provided that you comply with
+ the terms of this License in conveying all material for which you do
+ not control copyright. Those thus making or running the covered works
+ for you must do so exclusively on your behalf, under your direction
+ and control, on terms that prohibit them from making any copies of
+ your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+ the conditions stated below. Sublicensing is not allowed; section 10
+ makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+ measure under any applicable law fulfilling obligations under article
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
+ similar laws prohibiting or restricting circumvention of such
+ measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+ circumvention of technological measures to the extent such circumvention
+ is effected by exercising rights under this License with respect to
+ the covered work, and you disclaim any intention to limit operation or
+ modification of the work as a means of enforcing, against the work's
+ users, your or third parties' legal rights to forbid circumvention of
+ technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+ receive it, in any medium, provided that you conspicuously and
+ appropriately publish on each copy an appropriate copyright notice;
+ keep intact all notices stating that this License and any
+ non-permissive terms added in accord with section 7 apply to the code;
+ keep intact all notices of the absence of any warranty; and give all
+ recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+ and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+ produce it from the Program, in the form of source code under the
+ terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+ works, which are not by their nature extensions of the covered work,
+ and which are not combined with it such as to form a larger program,
+ in or on a volume of a storage or distribution medium, is called an
+ "aggregate" if the compilation and its resulting copyright are not
+ used to limit the access or legal rights of the compilation's users
+ beyond what the individual works permit. Inclusion of a covered work
+ in an aggregate does not cause this License to apply to the other
+ parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+ of sections 4 and 5, provided that you also convey the
+ machine-readable Corresponding Source under the terms of this License,
+ in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+ from the Corresponding Source as a System Library, need not be
+ included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+ tangible personal property which is normally used for personal, family,
+ or household purposes, or (2) anything designed or sold for incorporation
+ into a dwelling. In determining whether a product is a consumer product,
+ doubtful cases shall be resolved in favor of coverage. For a particular
+ product received by a particular user, "normally used" refers to a
+ typical or common use of that class of product, regardless of the status
+ of the particular user or of the way in which the particular user
+ actually uses, or expects or is expected to use, the product. A product
+ is a consumer product regardless of whether the product has substantial
+ commercial, industrial or non-consumer uses, unless such uses represent
+ the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+ procedures, authorization keys, or other information required to install
+ and execute modified versions of a covered work in that User Product from
+ a modified version of its Corresponding Source. The information must
+ suffice to ensure that the continued functioning of the modified object
+ code is in no case prevented or interfered with solely because
+ modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+ specifically for use in, a User Product, and the conveying occurs as
+ part of a transaction in which the right of possession and use of the
+ User Product is transferred to the recipient in perpetuity or for a
+ fixed term (regardless of how the transaction is characterized), the
+ Corresponding Source conveyed under this section must be accompanied
+ by the Installation Information. But this requirement does not apply
+ if neither you nor any third party retains the ability to install
+ modified object code on the User Product (for example, the work has
+ been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+ requirement to continue to provide support service, warranty, or updates
+ for a work that has been modified or installed by the recipient, or for
+ the User Product in which it has been modified or installed. Access to a
+ network may be denied when the modification itself materially and
+ adversely affects the operation of the network or violates the rules and
+ protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+ in accord with this section must be in a format that is publicly
+ documented (and with an implementation available to the public in
+ source code form), and must require no special password or key for
+ unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+ License by making exceptions from one or more of its conditions.
+ Additional permissions that are applicable to the entire Program shall
+ be treated as though they were included in this License, to the extent
+ that they are valid under applicable law. If additional permissions
+ apply only to part of the Program, that part may be used separately
+ under those permissions, but the entire Program remains governed by
+ this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+ remove any additional permissions from that copy, or from any part of
+ it. (Additional permissions may be written to require their own
+ removal in certain cases when you modify the work.) You may place
+ additional permissions on material, added by you to a covered work,
+ for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+ add to a covered work, you may (if authorized by the copyright holders of
+ that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+ restrictions" within the meaning of section 10. If the Program as you
+ received it, or any part of it, contains a notice stating that it is
+ governed by this License along with a term that is a further
+ restriction, you may remove that term. If a license document contains
+ a further restriction but permits relicensing or conveying under this
+ License, you may add to a covered work material governed by the terms
+ of that license document, provided that the further restriction does
+ not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+ must place, in the relevant source files, a statement of the
+ additional terms that apply to those files, or a notice indicating
+ where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+ form of a separately written license, or stated as exceptions;
+ the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+ provided under this License. Any attempt otherwise to propagate or
+ modify it is void, and will automatically terminate your rights under
+ this License (including any patent licenses granted under the third
+ paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+ license from a particular copyright holder is reinstated (a)
+ provisionally, unless and until the copyright holder explicitly and
+ finally terminates your license, and (b) permanently, if the copyright
+ holder fails to notify you of the violation by some reasonable means
+ prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+ reinstated permanently if the copyright holder notifies you of the
+ violation by some reasonable means, this is the first time you have
+ received notice of violation of this License (for any work) from that
+ copyright holder, and you cure the violation prior to 30 days after
+ your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+ licenses of parties who have received copies or rights from you under
+ this License. If your rights have been terminated and not permanently
+ reinstated, you do not qualify to receive new licenses for the same
+ material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+ run a copy of the Program. Ancillary propagation of a covered work
+ occurring solely as a consequence of using peer-to-peer transmission
+ to receive a copy likewise does not require acceptance. However,
+ nothing other than this License grants you permission to propagate or
+ modify any covered work. These actions infringe copyright if you do
+ not accept this License. Therefore, by modifying or propagating a
+ covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+ receives a license from the original licensors, to run, modify and
+ propagate that work, subject to this License. You are not responsible
+ for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+ organization, or substantially all assets of one, or subdividing an
+ organization, or merging organizations. If propagation of a covered
+ work results from an entity transaction, each party to that
+ transaction who receives a copy of the work also receives whatever
+ licenses to the work the party's predecessor in interest had or could
+ give under the previous paragraph, plus a right to possession of the
+ Corresponding Source of the work from the predecessor in interest, if
+ the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+ rights granted or affirmed under this License. For example, you may
+ not impose a license fee, royalty, or other charge for exercise of
+ rights granted under this License, and you may not initiate litigation
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
+ any patent claim is infringed by making, using, selling, offering for
+ sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+ License of the Program or a work on which the Program is based. The
+ work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+ owned or controlled by the contributor, whether already acquired or
+ hereafter acquired, that would be infringed by some manner, permitted
+ by this License, of making, using, or selling its contributor version,
+ but do not include claims that would be infringed only as a
+ consequence of further modification of the contributor version. For
+ purposes of this definition, "control" includes the right to grant
+ patent sublicenses in a manner consistent with the requirements of
+ this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+ patent license under the contributor's essential patent claims, to
+ make, use, sell, offer for sale, import and otherwise run, modify and
+ propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+ agreement or commitment, however denominated, not to enforce a patent
+ (such as an express permission to practice a patent or covenant not to
+ sue for patent infringement). To "grant" such a patent license to a
+ party means to make such an agreement or commitment not to enforce a
+ patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+ and the Corresponding Source of the work is not available for anyone
+ to copy, free of charge and under the terms of this License, through a
+ publicly available network server or other readily accessible means,
+ then you must either (1) cause the Corresponding Source to be so
+ available, or (2) arrange to deprive yourself of the benefit of the
+ patent license for this particular work, or (3) arrange, in a manner
+ consistent with the requirements of this License, to extend the patent
+ license to downstream recipients. "Knowingly relying" means you have
+ actual knowledge that, but for the patent license, your conveying the
+ covered work in a country, or your recipient's use of the covered work
+ in a country, would infringe one or more identifiable patents in that
+ country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+ arrangement, you convey, or propagate by procuring conveyance of, a
+ covered work, and grant a patent license to some of the parties
+ receiving the covered work authorizing them to use, propagate, modify
+ or convey a specific copy of the covered work, then the patent license
+ you grant is automatically extended to all recipients of the covered
+ work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+ the scope of its coverage, prohibits the exercise of, or is
+ conditioned on the non-exercise of one or more of the rights that are
+ specifically granted under this License. You may not convey a covered
+ work if you are a party to an arrangement with a third party that is
+ in the business of distributing software, under which you make payment
+ to the third party based on the extent of your activity of conveying
+ the work, and under which the third party grants, to any of the
+ parties who would receive the covered work from you, a discriminatory
+ patent license (a) in connection with copies of the covered work
+ conveyed by you (or copies made from those copies), or (b) primarily
+ for and in connection with specific products or compilations that
+ contain the covered work, unless you entered into that arrangement,
+ or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+ any implied license or other defenses to infringement that may
+ otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+ otherwise) that contradict the conditions of this License, they do not
+ excuse you from the conditions of this License. If you cannot convey a
+ covered work so as to satisfy simultaneously your obligations under this
+ License and any other pertinent obligations, then as a consequence you may
+ not convey it at all. For example, if you agree to terms that obligate you
+ to collect a royalty for further conveying from those to whom you convey
+ the Program, the only way you could satisfy both those terms and this
+ License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+ permission to link or combine any covered work with a work licensed
+ under version 3 of the GNU Affero General Public License into a single
+ combined work, and to convey the resulting work. The terms of this
+ License will continue to apply to the part which is the covered work,
+ but the special requirements of the GNU Affero General Public License,
+ section 13, concerning interaction through a network will apply to the
+ combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+ the GNU General Public License from time to time. Such new versions will
+ be similar in spirit to the present version, but may differ in detail to
+ address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+ Program specifies that a certain numbered version of the GNU General
+ Public License "or any later version" applies to it, you have the
+ option of following the terms and conditions either of that numbered
+ version or of any later version published by the Free Software
+ Foundation. If the Program does not specify a version number of the
+ GNU General Public License, you may choose any version ever published
+ by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+ versions of the GNU General Public License can be used, that proxy's
+ public statement of acceptance of a version permanently authorizes you
+ to choose that version for the Program.
+
+ Later license versions may give you additional or different
+ permissions. However, no additional obligations are imposed on any
+ author or copyright holder as a result of your choosing to follow a
+ later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+ above cannot be given local legal effect according to their terms,
+ reviewing courts shall apply local law that most closely approximates
+ an absolute waiver of all civil liability in connection with the
+ Program, unless a warranty or assumption of liability accompanies a
+ copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+ possible use to the public, the best way to achieve this is to make it
+ free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+ to attach them to the start of each source file to most effectively
+ state the exclusion of warranty; and each file should have at least
+ the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+ notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+ The hypothetical commands `show w' and `show c' should show the appropriate
+ parts of the General Public License. Of course, your program's commands
+ might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
+ For more information on this, and how to apply and follow the GNU GPL, see
+ <http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+ into proprietary programs. If your program is a subroutine library, you
+ may consider it more useful to permit linking proprietary applications with
+ the library. If this is what you want to do, use the GNU Lesser General
+ Public License instead of this License. But first, please read
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
+
commit 238421bb9ebbf6d13564374f086646efffc4943f
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Feb 16 00:12:11 2009 -0500
Add a full table of contents to our docs
diff --git a/docs/contents.rst b/docs/contents.rst
new file mode 100644
index 0000000..a924210
--- /dev/null
+++ b/docs/contents.rst
@@ -0,0 +1,18 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ Moksha Documentation contents
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+.. toctree::
+
+ main/Vision
+ main/Architecture
+ main/GettingStarted
+ main/Widgets
+ main/MokshaApplications
+ main/Messaging
+ main/Middleware
+ main/Development
+ main/Deployment
+
+ copyright
+ license
15 years, 4 months
2 commits - development.ini moksha/streams
by Luke Macken
development.ini | 5
moksha/streams/feed/feedstream.py | 285 ++++++++++++++++++++++++++++++++++++--
2 files changed, 280 insertions(+), 10 deletions(-)
New commits:
commit 467713a0758507f48ea23bb1d7d3c60a5c66cc02
Merge: 95bd7fa... ffd12a1...
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Feb 13 02:45:27 2009 -0500
Merge branch 'master' of git+ssh://git.fedorahosted.org/git/moksha
commit 95bd7fad7b79dba7aaaf9b1c978965089267124a
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Feb 13 02:45:00 2009 -0500
Commit my first pass at a twisted-based Feed Streamer
diff --git a/development.ini b/development.ini
index 2c41abb..4fa8376 100644
--- a/development.ini
+++ b/development.ini
@@ -20,7 +20,10 @@ error_email_from = paste@localhost
# Where to store the feed caches.
feed_cache = sqlite:///%(here)s/feeds.db
-#feed_cache = %(here)s/data/feeds
+# Max age (in seconds) of each feed in the cache
+feed.max_age = 300
+# Timeout in seconds for the web request
+feed.timeout = 30
# Where to initialize and store our application databases. %s is the app name.
app_db = sqlite:///%s.db
diff --git a/moksha/streams/feed/feedstream.py b/moksha/streams/feed/feedstream.py
index b7b2e5e..0225e11 100644
--- a/moksha/streams/feed/feedstream.py
+++ b/moksha/streams/feed/feedstream.py
@@ -1,10 +1,264 @@
+# This file is part of Moksha.
+#
+# Moksha is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Moksha is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Moksha. If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright 2008, Red Hat, Inc.
+# Authors: Luke Macken <lmacken(a)redhat.com>
+
+import moksha
import logging
+import feedparser, time, sys
+import md5, os
+
+try:
+ from cStringIO import cStringIO as StringIO
+except ImportError:
+ from StringIO import StringIO
-from datetime import timedelta
+from twisted.web import client
+from twisted.web.client import HTTPPageGetter, HTTPClientFactory
+from twisted.internet import reactor, protocol, defer, ssl
+from twisted.web import error
+from datetime import timedelta, datetime
+from feedcache import Cache
+from shove import Shove
+from tg import config
from moksha.api.streams import PollingDataStream
+from moksha.lib.helpers import trace
+
+log = logging.getLogger('moksha.hub')
+
+feed_storage = Shove(config['feed_cache'], compress=True)
+feed_cache = Cache(feed_storage)
+
+class ConditionalHTTPPageGetter(HTTPPageGetter):
+
+ def handleStatus_200(self):
+ """ If we're good, try recording the last-modified header """
+ if self.headers.has_key('last-modified'):
+ self.factory.lastModified(self.headers['last-modified'])
+
+ def handleStatus_304(self):
+ """ Close connection """
+ self.factory.notModified()
+ self.transport.loseConnection()
+
+
+class ConditionalHTTPClientFactory(HTTPClientFactory):
+
+ protocol = ConditionalHTTPPageGetter
+
+ def __init__(self, url, method='GET', postdata=None, headers=None,
+ agent="Moksha Feed Streamer", timeout=0, cookies=None,
+ followRedirect=1):
+
+ self.url = url
+
+ if url in feed_storage:
+ lastModified = time.ctime(feed_storage[url][0])
+ if headers is not None:
+ headers['last-modified'] = lastModified
+ else:
+ headers = {'last-modified': lastModified}
+
+ HTTPClientFactory.__init__(self, url, method=method, postdata=postdata,
+ headers=headers, agent=agent, timeout=timeout, cookies=cookies,
+ followRedirect=followRedirect)
+
+ self.waiting = True
+ self.deferred = defer.Deferred()
+
+ def lastModified(self, modtime):
+ t = time.mktime(time.strptime(modtime[0], '%a, %d %b %Y %H:%M:%S %Z'))
+ parsed_feed = {}
+
+ if self.url in feed_storage:
+ current_feed = feed_storage[self.url][1]
+ if current_feed and not current_feed.get('bozo_exception'):
+ parsed_feed = current_feed
+
+ try:
+ feed_storage[self.url] = (t, parsed_feed)
+ except:
+ log.error("Unable to store parsed_feed: %r" % parsed_feed)
+ raise
+
+ def notModified():
+ if self.waiting:
+ self.waiting = False
+
+
+def conditional_get_page(url, contextFactory=None, *args, **kwargs):
+ scheme, host, port, path = client._parse(url)
+ factory = ConditionalHTTPClientFactory(url, *args, **kwargs)
+ if scheme == 'https':
+ if contextFactory is None:
+ contextFactory = ssl.ClientContextFactory()
+ reactor.connectSSL(host, port, factory, contextFactory)
+ else:
+ reactor.connectTCP(host, port, factory)
+ return factory.deferred
+
+
+class FeederProtocol(object):
+
+ max_age = int(config.get('feed.max_age', 300))
+ timeout = int(config.get('feed.timeout', 30))
+
+ def __init__(self):
+ self.parsed = 1
+ self.with_errors = 0
+ self.error_list = []
+
+ def is_cached(self, site):
+ already_got = feed_storage.get(site[0])
+ if already_got:
+ elapsed_time = time.time() - already_got[0]
+ if elapsed_time < self.max_age:
+ return True
+ else:
+ return False
+ else:
+ return False
+
+ def on_error(self, traceback, extra_args):
+ log.error(extra_args)
+ log.exception(traceback)
+ self.with_errors += 1
+ self.error_list.append(extra_args)
+
+ def get_feed_from_cache(self, data, key=None):
+ """ Return feed data from the cache based on a given ``key`` """
+ log.debug('Getting cached feed for %s' % key)
+ return defer.succeed(feed_storage.get(key, key)[1])
+
+ def parse_feed(self, feed, url):
+ if not feed:
+ log.warning('parse_feed got %r for %s' % (feed, url))
+ return {}
+ if not isinstance(feed, basestring):
+ feed = str(feed)
+ feed = feedparser.parse(StringIO(feed))
+ assert feed
+ if feed.get('bozo_exception'):
+ bozo_exc = str(feed['bozo_exception'])
+ log.warning("Feed %s getting bozo_exception %r" % (feed, bozo_exc))
+ feed['bozo_exception'] = bozo_exc
+ return feed
+
+ def store_feed(self, feed, addr):
+ feed_storage[addr] = (time.time(), feed)
+ return feed
+
+ def process_feed(self, parsed_feed, addr):
+ if not parsed_feed:
+ log.error("Cannot process %r feed for %s" % (parsed_feed, addr))
+ return
+ chan = parsed_feed.get('channel', None)
+ if chan:
+ log.debug(chan.get('title', ''))
+ # print chan.get('link', '')
+ # #print chan.get('tagline', '')
+ # print chan.get('description','')
+ #print "-"*20
+ #items = parsed_feed.get('items', None)
+ #if items:
+ # for item in items:
+ # print '\tTitle: ', item.get('title','')
+ # print '\tDate: ', item.get('date', '')
+ # print '\tLink: ', item.get('link', '')
+ # print '\tDescription: ', item.get('description', '')
+ # print '\tSummary: ', item.get('summary','')
+ # print "-"*20
+ #print "got",addr
+ #print "="*40
+ return parsed_feed
+
+ ## @@ post processing
+ for url in feed_storage:
+ olddata = feed_storage[url][1].copy()
+ newdata = feed_cache.fetch(url) #, force_update=True)
+ # If there are no new entries, move on...
+ if newdata['entries'][0]['title'] == olddata['entries'][0]['title']:
+ log.debug('No feed changes for %s' % url)
+ del(olddata)
+ continue
+ oldtitles = [entry['title'] for entry in olddata['entries']]
+ for entry in newdata['entries'][::-1]:
+ # If we haven't seen this entry yet...
+ if entry['title'] not in oldtitles:
+ # Send a message to the feed's topic
+ print "New entry:", entry['title']
+ self.send_message('feed.%s' % entry.channel.link,
+ {'title': entry['title'], 'link': entry['link']})
+ else:
+ print "Dupe entry", entry['title']
+
+
+ def get_page(self, data, args):
+ return conditional_get_page(args, timeout=self.timeout)
+
+ def print_status(self, data=None):
+ pass
+
+ def start(self, data=None):
+ d = defer.succeed(True)
+ for feed in data:
+ if self.is_cached(feed):
+ d.addCallback(self.get_feed_from_cache, feed[0])
+ d.addErrback(self.on_error, (feed[0], 'fetching from cache'))
+ else:
+ d.addCallback(self.get_page, feed[0])
+ d.addErrback(self.on_error, (feed[0], 'fetching'))
+ d.addCallback(self.parse_feed, feed[0])
+ d.addErrback(self.on_error, (feed[0], 'parsing'))
+ d.addCallback(self.store_feed, feed[0])
+ d.addErrback(self.on_error, (feed[0], 'storing'))
+ d.addCallback(self.process_feed, feed[0])
+ d.addErrback(self.on_error, (feed[0], 'processing'))
+ return d
+
+
+class FeederFactory(protocol.ClientFactory):
+
+ protocol = FeederProtocol()
+
+ def __init__(self, deferred_groups=60):
+ """Initialize the Feeder Factory.
+
+ :param deferred_groups: The number of simultaneous connections
+ """
+ self.protocol.factory = self
+ self.deferred_groups = deferred_groups
+
+ def start(self, addresses):
+ """Divide into groups all the feeds to download.
+
+ :param addresses: A list of feed urls
+ """
+ log.info("Starting the FeederFactory...")
+ if len(addresses) > self.deferred_groups:
+ url_groups = [[] for x in xrange(self.deferred_groups)]
+ for i, addr in enumerate(addresses):
+ url_groups[i % self.deferred_groups].append(addr)
+ else:
+ url_groups = [[addr] for addr in addresses]
+ log.info("Creating %d url groups" % len(url_groups))
+ for group in url_groups:
+ self.protocol.start(group)
-log = logging.getLogger(__name__)
class FeedStream(PollingDataStream):
"""
@@ -12,23 +266,36 @@ class FeedStream(PollingDataStream):
then Moksha will automatically handle polling it. Upon new entries,
AMQP messages will be sent to the `feeds.$URL` queue.
"""
-
- frequency = timedelta(minutes=15)
+ #frequency = timedelta(minutes=15)
+ frequency = 5 # seconds
+ running = False
def poll(self):
""" Poll all known feeds.
- Iterate over all feeds in our global moksha feed cache..
- Problem:: the MokshaHub will not use this unless both it and the
+ :Warning: the MokshaHub will not use this unless both it and the
Moksha WSGI app are using the same `feed_cache` database.
- Keep feed caches fresh.
+
- Send messages to topics for new entries
`feed.$NAME` topic ?
`tag.category
"""
+ # @@ Only run once... for testing purposes
+ if self.running:
+ print "Feed streamer already running"
+ return
+ self.running = True
+
log.debug('FeedStream.poll()')
- # gather all feed urls... from all moksha.widget Feed objects, and
- # make sure to search WidgetBunches as well!
- # Parse each feed, and send the data to it's AMQP topic
- # Repeat... but not too fast!
+ feeds = map(lambda x: x.strip(), file('feeds.txt').readlines())
+ feeds = [(feed, '') for feed in feeds]
+ f = FeederFactory()
+ f.start(addresses=feeds)
+ return
+
+ def stop(self):
+ feed_storage.close()
+ super(FeedStream, self).stop()
15 years, 4 months
moksha/api moksha/lib moksha/public
by John (J5) Palmieri
moksha/api/widgets/containers/dashboardcontainer.py | 2
moksha/api/widgets/containers/tabbedcontainer.py | 12 +-
moksha/api/widgets/containers/templates/dashboardcontainer.mak | 3
moksha/api/widgets/containers/templates/layout_applist.mak | 2
moksha/lib/helpers.py | 50 ++++++----
moksha/public/javascript/ui/moksha.ui.tabs.js | 9 +
6 files changed, 52 insertions(+), 26 deletions(-)
New commits:
commit ffd12a181a2f11f25b8ed10dda11a5e7d2d9f297
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Wed Feb 11 19:57:27 2009 -0500
make passing dynamic parameters to apps possible
diff --git a/moksha/api/widgets/containers/dashboardcontainer.py b/moksha/api/widgets/containers/dashboardcontainer.py
index 6892d6f..0dde052 100644
--- a/moksha/api/widgets/containers/dashboardcontainer.py
+++ b/moksha/api/widgets/containers/dashboardcontainer.py
@@ -43,7 +43,7 @@ class DashboardContainer(Widget):
# Filter out any None's in the layout which signify apps which are
# not allowed to run with the current session's authorization level
- l = ConfigWrapper.process_wrappers(layout)
+ l = ConfigWrapper.process_wrappers(layout, d)
d['layout'] = l
d['applist_widget'] = applist_widget
diff --git a/moksha/api/widgets/containers/tabbedcontainer.py b/moksha/api/widgets/containers/tabbedcontainer.py
index fc5577b..67d0b39 100644
--- a/moksha/api/widgets/containers/tabbedcontainer.py
+++ b/moksha/api/widgets/containers/tabbedcontainer.py
@@ -50,9 +50,10 @@ class TabbedContainer(FormField):
tabs = ()
javascript = [moksha_ui_tabs_js
]
- params = ["tabdefault"]
+ params = ["tabdefault", "passPathRemainder"]
tabdefault__doc="0-based index of the tab to be selected on page load"
- tabdefault='#my_profile'
+ tabdefault=0
+ passPathRemainder=False
# include_dynamic_js_calls = True #????
def update_params(self, d):
super(TabbedContainer, self).update_params(d)
@@ -60,8 +61,9 @@ class TabbedContainer(FormField):
raise ValueError, "JQueryUITabs is supposed to have id"
o = {
- 'tabdefault': d.get('tabdefault', 0)
- }
+ 'tabdefault': d.get('tabdefault', 0),
+ 'passPathRemainder': d.get('passPathRemainder', False)
+ }
self.add_call(jQuery("#%s" % d.id).mokshatabs(o))
tabs = eval_app_config(config.get(self.config_key, "None"))
@@ -73,7 +75,7 @@ class TabbedContainer(FormField):
# Filter out any None's in the list which signify apps which are
# not allowed to run with the current session's authorization level
- tabs = ConfigWrapper.process_wrappers(tabs)
+ tabs = ConfigWrapper.process_wrappers(tabs, d)
d['tabs'] = tabs
d['tabwidget'] = tabwidget
d['panewidget'] = panewidget
diff --git a/moksha/api/widgets/containers/templates/dashboardcontainer.mak b/moksha/api/widgets/containers/templates/dashboardcontainer.mak
index dd4e57d..a9042da 100644
--- a/moksha/api/widgets/containers/templates/dashboardcontainer.mak
+++ b/moksha/api/widgets/containers/templates/dashboardcontainer.mak
@@ -1,8 +1,7 @@
<div>
- Sample Template - you should subclass and create your own layout
<div id="container">
% for c in layout:
- ${applist_widget(category = c)}
+ ${applist_widget(category=c)}
% endfor
</div>
diff --git a/moksha/api/widgets/containers/templates/layout_applist.mak b/moksha/api/widgets/containers/templates/layout_applist.mak
index af2021a..8dc1fa6 100644
--- a/moksha/api/widgets/containers/templates/layout_applist.mak
+++ b/moksha/api/widgets/containers/templates/layout_applist.mak
@@ -12,7 +12,7 @@
% if not app.has_key('widget'):
<script type="text/javascript">
- $("#${app['id']}").load("${app['url']}");
+ $("#${app['id']}").load("${app['url']}", ${app['params']});
</script>
% endif
diff --git a/moksha/lib/helpers.py b/moksha/lib/helpers.py
index fa891e2..f3c4586 100644
--- a/moksha/lib/helpers.py
+++ b/moksha/lib/helpers.py
@@ -7,6 +7,7 @@ from repoze.what.predicates import (Not, Predicate, All, Any, has_all_permissio
import urllib
import uuid
+import simplejson as json
import re
from decorator import decorator
@@ -14,6 +15,23 @@ import moksha
scrub_filter = re.compile('[^_a-zA-Z0-9-]')
+def _update_params(params, d):
+ p = {}
+ if params:
+ for k in params.iterkeys():
+
+ if d and (k in d):
+ p[k] = d[k]
+ else:
+ p[k] = params[k]
+
+ if isinstance(p[k], dict) or isinstance(p[k], list):
+ p[k] = json.dumps(p[k])
+
+ return p
+
+ return params
+
class ConfigWrapper(object):
""" Base class for container configuration wrappers
@@ -34,7 +52,7 @@ class ConfigWrapper(object):
"""
@staticmethod
- def process_wrappers(wrappers):
+ def process_wrappers(wrappers, dict):
""" Helper method for evlauating a list of wrappers
:returns: a list of hashes for each of the application
@@ -43,18 +61,18 @@ class ConfigWrapper(object):
result = []
if isinstance(wrappers, ConfigWrapper):
- w = wrappers.process()
+ w = wrappers.process(dict)
if w:
result.append(w)
else:
for item in wrappers:
- w = item.process()
+ w = item.process(dict)
if w:
result.append(w)
return result
- def process(self):
+ def process(self, dict=None):
"""Override this in derived classes to return a hash representing
the configuration option
"""
@@ -96,7 +114,7 @@ class Category(ConfigWrapper):
self.css_class = css_class
- def process(self):
+ def process(self, dict=None):
"""Check the predicates and construct the dict
:returns: a dict with all the configuration data for this category
@@ -107,7 +125,7 @@ class Category(ConfigWrapper):
id = uuid.uuid4()
- apps = self.process_wrappers(self.apps)
+ apps = self.process_wrappers(self.apps, dict)
return {'label': self.label, 'apps': apps, 'id': id, 'css_class': self.css_class}
class App(ConfigWrapper):
@@ -146,7 +164,7 @@ class App(ConfigWrapper):
if self.label and not self.content_id:
self.content_id = scrub_filter.sub('_', self.label.lower())
- def process(self):
+ def process(self, dict=None):
"""Check the predicates and construct the dict
:returns: a dict with all the configuration data for this application
@@ -154,13 +172,11 @@ class App(ConfigWrapper):
if not check_predicates(self.auth):
return None
- query_str = ""
- if self.params:
- query_str = "?" + urllib.urlencode(self.params)
-
id = 'uuid' + str(uuid.uuid4())
- return {'label': self.label, 'url': self.url + query_str, 'id': id,
+ return {'label': self.label, 'url': self.url,
+ 'params': _update_params(self.params, dict),
+ 'id': id,
'content_id': self.content_id + '-' + id}
class MokshaApp(App):
@@ -204,14 +220,14 @@ class MokshaApp(App):
content_id,
params, auth)
- def process(self):
+ def process(self, dict=None):
# We return a placeholder if the app is not registered
if not moksha.apps.has_key(self.app):
return MokshaWidget(self.label, 'placeholder',
self.content_id,
- {'appname':self.app}, self.auth).process()
+ {'appname':self.app}, self.auth).process(dict)
- return super(MokshaApp, self).process()
+ return super(MokshaApp, self).process(dict)
class Widget(ConfigWrapper):
"""A configuration wrapper class that displays a ToscaWidget. Use this
@@ -258,14 +274,14 @@ class Widget(ConfigWrapper):
self.content_id += '-' + self.id
- def process(self):
+ def process(self, dict):
if not check_predicates(self.auth):
return None
url = '#' + self.content_id
return {'label': self.label, 'url': url,'widget': self.widget ,
- 'params':self.params, 'id': self.id, 'content_id': self.content_id}
+ 'params':_update_params(self.params, dict), 'id': self.id, 'content_id': self.content_id}
class MokshaWidget(Widget):
"""A configuration wrapper class that displays a ToscaWidget registered
diff --git a/moksha/public/javascript/ui/moksha.ui.tabs.js b/moksha/public/javascript/ui/moksha.ui.tabs.js
index d09c6f7..5208344 100644
--- a/moksha/public/javascript/ui/moksha.ui.tabs.js
+++ b/moksha/public/javascript/ui/moksha.ui.tabs.js
@@ -59,6 +59,7 @@ $.widget("ui.mokshatabs", {
var self = this, o = this.options;
+ self.path_remainder = '';
self.options.hash_level = _moksha_hash_consumer_level;
this.$tabs.each(function(i, a) {
// inline tab
@@ -464,6 +465,10 @@ $.widget("ui.mokshatabs", {
var id = "#" + hash[level + offset];
+ var remainder = level + offset + 1;
+ if (this.options.passPathRemainder && hash.length > remainder)
+ this.path_remainder = '/' + hash.splice(level + offset + 1).join('/');
+
return this.idToIndex(id);
},
idToIndex: function(id) {
@@ -520,6 +525,9 @@ $.widget("ui.mokshatabs", {
.find('em').data('label.tabs', label).html(o.spinner);
}
+ if (o.passPathRemainder)
+ url += self.path_remainder;
+
var ajaxOptions = $.extend({}, o.ajaxOptions, {
url: url,
success: function(r, s) {
@@ -601,6 +609,7 @@ $.ui.mokshatabs.defaults = {
cache: false,
idPrefix: 'ui-tabs-',
ajaxOptions: {},
+ passPathRemainder:false,
// animations
fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
15 years, 4 months