PK:4dt  EGG-INFO/entry_points.txt [console_scripts] tg-admin = turbogears.command:main [distutils.commands] docs = turbogears.docgen:GenSite [paste.paster_create_template] tgbase = turbogears.command.quickstart:BaseTemplate turbogears = turbogears.command.quickstart:TurbogearsTemplate tgbig = turbogears.command.quickstart:TGBig tgwidget = turbogears.command.quickstart:TGWidgetTemplate [turbogears.command] quickstart = turbogears.command.quickstart:quickstart sql = turbogears.command.base:SQL shell = turbogears.command.base:Shell toolbox = turbogears.command.base:ToolboxCommand update = turbogears.command.quickstart:update i18n = turbogears.command.i18n:InternationalizationTool info = turbogears.command.info:InfoCommand [turbogears.view.engine] kid = turbogears.kidsupport:KidSupport [turbogears.identity.provider] sqlobject = turbogears.identity.soprovider:SqlObjectIdentityProvider sqlalchemy= turbogears.identity.saprovider:SqlAlchemyIdentityProvider [turbogears.extensions] identity = turbogears.identity.visitor visit = turbogears.visit [turbogears.visit.manager] sqlobject = turbogears.visit.sovisit:SqlObjectVisitManager sqlalchemy = turbogears.visit.savisit:SqlAlchemyVisitManager PKvm4EGG-INFO/not-zip-safePK:4ICEGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: TurboGears Version: 0.9a5 Summary: front-to-back rapid web development Home-page: http://www.turbogears.org Author: Kevin Dangoor Author-email: dangoor+turbogears@gmail.com License: MIT Download-URL: http://www.turbogears.org/download/ Description: TurboGears brings together four major pieces to create an easy to install, easy to use web megaframework. It covers everything from front end (MochiKit JavaScript for the browser, Kid for templates in Python) to the controllers (CherryPy) to the back end (SQLObject). The TurboGears project is focused on providing documentation and integration with these tools without losing touch with the communities that already exist around those tools. TurboGears is easy to use for a wide range of web applications. The latest development version is available in the TurboGears subversion repository. Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha Classifier: Environment :: Console Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Topic :: Software Development :: Libraries :: Python Modules PK:4DM  EGG-INFO/requires.txtTurboJson >= 0.9.2 TurboKid >= 0.9.5 CherryPy >= 2.2.1 SQLObject >= 0.7.1dev_r1457 simplejson >= 1.3 elementtree >= 1.2.6 PasteScript >= 0.5.1 cElementTree >= 1.0.5 FormEncode >= 0.5.1 setuptools >= 0.6a11 RuleDispatch ConfigObj >= 4.3.0 nose >= 0.8 [exp] TGFastDataPK:4l,:!&!&EGG-INFO/SOURCES.txtCHANGELOG.txt CONTRIBUTORS.txt LICENSE.txt README.txt codename.py ez_setup.py setup.cfg setup.py toolbox-start.py TurboGears.egg-info/PKG-INFO TurboGears.egg-info/SOURCES.txt TurboGears.egg-info/entry_points.txt TurboGears.egg-info/not-zip-safe TurboGears.egg-info/requires.txt TurboGears.egg-info/top_level.txt docs/MochiKit.js docs/TurboGears-Logo.png docs/btlogo.png docs/bugbounty.html docs/button-bg.png docs/default.css docs/favicon.ico docs/gear.gif docs/index.html docs/newfile.html docs/printable.html docs/sleight.js docs/sleightbg.js docs/smallzestynewslogo.png docs/style.css docs/template.html docs/tgheader.png docs/about/changelog.html docs/about/cherrypy.html docs/about/cherrypy.png docs/about/extras.html docs/about/howitallfits-thumb.jpg docs/about/howitallfits.jpg docs/about/index.html docs/about/kid.html docs/about/kid.png docs/about/license.html docs/about/mochikit.html docs/about/mochikit.png docs/about/philosophy.html docs/about/sqlobject.html docs/about/sqlobject.png docs/about/status.html docs/about/turbogears.html docs/about/turbogearsparts.png docs/community/contributing.html docs/community/index.html docs/community/projects.html docs/docs/admin.html docs/docs/cookies.html docs/docs/devcasts.html docs/docs/gettinghelp.html docs/docs/gettingstarted.html docs/docs/index.html docs/docs/sessions.html docs/docs/testing.html docs/docs/thirdparty.html docs/docs/videohelp.html docs/docs/TurboTunes/TurboTunes.mov docs/docs/TurboTunes/TurboTunes.png docs/docs/TurboTunes/catwalk.mov docs/docs/TurboTunes/catwalk_clip.png docs/docs/TurboTunes/controllers.py docs/docs/TurboTunes/create.png docs/docs/TurboTunes/index.html docs/docs/TurboTunes/model.py docs/docs/TurboTunes/tunes.kid docs/docs/TurboTunes/turbotunes.zip docs/docs/deployment/config.html docs/docs/deployment/index.html docs/docs/deployment/lighttpd.html docs/docs/deployment/mod_python.html docs/docs/plugins/command.html docs/docs/plugins/index.html docs/docs/plugins/template.html docs/docs/toolbox/catwalk.html docs/docs/toolbox/index.html docs/docs/toolbox/modeldesigner.html docs/docs/toolbox/webconsole.html docs/docs/toolbox/widgetbrowser.html docs/docs/tutorials/wiki20/20minutess.png docs/docs/tutorials/wiki20/index.html docs/docs/tutorials/wiki20/page2.html docs/docs/tutorials/wiki20/page3.html docs/docs/tutorials/wiki20/page4.html docs/docs/tutorials/wiki20/page5.html docs/docs/tutorials/wiki20/page6.html docs/docs/tutorials/wiki20/wiki20.tgz docs/docs/tutorials/wikitest/index.html docs/docs/wiki20/20minutess.png docs/docs/wiki20/index.html docs/docs/wiki20/page2.html docs/docs/wiki20/page3.html docs/docs/wiki20/page4.html docs/docs/wiki20/page5.html docs/docs/wiki20/page6.html docs/docs/wiki20/wiki20.tgz docs/download/dltemplate.kid docs/download/index.html docs/download/install.html docs/download/mac.html docs/download/nix.html docs/download/upgrade.html docs/download/windows.html docs/images/advance-search.gif docs/images/bg1.gif docs/images/btn-go.gif docs/images/btn-ok.gif docs/images/btn-submit.gif docs/images/caption.gif docs/images/corner_top_left.gif docs/images/corner_top_right.gif docs/images/curve.jpg docs/images/edgecolor.gif docs/images/header_bg.gif docs/images/header_left.gif docs/images/header_logo.gif docs/images/header_right.gif docs/images/homeimg.jpg docs/images/homeimg1.jpg docs/images/icon-contact.gif docs/images/icon-home.gif docs/images/icon-sitemap.gif docs/images/img01.jpg docs/images/img02.jpg docs/images/insidecolor.gif docs/images/leftbox-bg.gif docs/images/leftbox-bl.gif docs/images/leftbox-bottom.gif docs/images/leftbox-br.gif docs/images/leftbox-tl.gif docs/images/leftbox-top.gif docs/images/leftbox-tr.gif docs/images/loginbg.gif docs/images/nav-left.png docs/images/nav-right.png docs/images/newsletter-bg.gif docs/images/newsletter.gif docs/images/rightbox-bottom.gif docs/images/search-bg.gif docs/images/sidebar_bottom_left.gif docs/images/sidebar_h1_top_right.gif docs/images/skinnyrightbox.gif docs/images/trans.gif docs/images/welcometxt-bg.jpg docs/sh/SyntaxHighlighter.css docs/sh/shBrushCSharp.js docs/sh/shBrushDelphi.js docs/sh/shBrushJScript.js docs/sh/shBrushPhp.js docs/sh/shBrushPython.js docs/sh/shBrushSql.js docs/sh/shBrushVb.js docs/sh/shBrushXml.js docs/sh/shCore.js docs/support/index.html newdocs/MochiKit.js newdocs/TurboGears-Logo.png newdocs/base.html newdocs/btlogo.png newdocs/bugbounty.html newdocs/button-bg.png newdocs/default.css newdocs/favicon.ico newdocs/gear.gif newdocs/index.html newdocs/newfile.html newdocs/printable.html newdocs/sleight.js newdocs/sleightbg.js newdocs/smallzestynewslogo.png newdocs/style.css newdocs/template.html newdocs/tgheader.png newdocs/turbobob.html newdocs/about/changelog.html newdocs/about/cherrypy.html newdocs/about/cherrypy.png newdocs/about/extras.html newdocs/about/howitallfits-thumb.jpg newdocs/about/howitallfits.jpg newdocs/about/index.html newdocs/about/kid.html newdocs/about/kid.png newdocs/about/license.html newdocs/about/mochikit.html newdocs/about/mochikit.png newdocs/about/philosophy.html newdocs/about/sqlobject.html newdocs/about/sqlobject.png newdocs/about/status.html newdocs/about/turbogears.html newdocs/about/turbogearsparts.png newdocs/community/contributing.html newdocs/community/index.html newdocs/docs/admin.html newdocs/docs/apacheintegration.html newdocs/docs/cookies.html newdocs/docs/deployaswindowsservice.html newdocs/docs/devcasts.html newdocs/docs/docgen.html newdocs/docs/dreamweaverintegration.html newdocs/docs/gettinghelp.html newdocs/docs/gettingstarted.html newdocs/docs/index.html newdocs/docs/installingfromsvn.html newdocs/docs/modpythonintegration.html newdocs/docs/sessions.html newdocs/docs/testing.html newdocs/docs/thirdparty.html newdocs/docs/turbogearsondreamhost.html newdocs/docs/videohelp.html newdocs/docs/TurboTunes/TurboTunes.mov newdocs/docs/TurboTunes/TurboTunes.png newdocs/docs/TurboTunes/catwalk.mov newdocs/docs/TurboTunes/catwalk_clip.png newdocs/docs/TurboTunes/controllers.py newdocs/docs/TurboTunes/create.png newdocs/docs/TurboTunes/index.html newdocs/docs/TurboTunes/model.py newdocs/docs/TurboTunes/tunes.kid newdocs/docs/TurboTunes/turbotunes.zip newdocs/docs/deployment/config.html newdocs/docs/deployment/index.html newdocs/docs/deployment/lighttpd.html newdocs/docs/deployment/mod_python.html newdocs/docs/gs/admin.html newdocs/docs/gs/arguments.html newdocs/docs/gs/bigpicture.html newdocs/docs/gs/configuration.html newdocs/docs/gs/cpexposed.html newdocs/docs/gs/definedatabase.html newdocs/docs/gs/designer.html newdocs/docs/gs/gstemplate.kid newdocs/docs/gs/headersfooters.html newdocs/docs/gs/index.html newdocs/docs/gs/json.html newdocs/docs/gs/kid.html newdocs/docs/gs/mochikit.html newdocs/docs/gs/othertemplate.html newdocs/docs/gs/predefined.html newdocs/docs/gs/server.html newdocs/docs/gs/templatechoice.html newdocs/docs/gs/testing.html newdocs/docs/gs/urls.html newdocs/docs/gs/usedatabase.html newdocs/docs/gs/validation.html newdocs/docs/identity/index.html newdocs/docs/plugins/command.html newdocs/docs/plugins/index.html newdocs/docs/plugins/template.html newdocs/docs/services/consulting.html newdocs/docs/services/hosting.html newdocs/docs/toolbox/catwalk.html newdocs/docs/toolbox/index.html newdocs/docs/toolbox/modeldesigner.html newdocs/docs/toolbox/webconsole.html newdocs/docs/toolbox/widgetbrowser.html newdocs/docs/tutorials/eajaxtg/EffectiveAjaxTG.tar.gz newdocs/docs/tutorials/eajaxtg/index.html newdocs/docs/tutorials/eajaxtg/paper.html newdocs/docs/tutorials/eajaxtg/paper_files/ButterflyVote.png newdocs/docs/tutorials/eajaxtg/paper_files/CookieDrop.png newdocs/docs/tutorials/eajaxtg/paper_files/DocUpdate.png newdocs/docs/tutorials/eajaxtg/paper_files/FlamingCanyon.jpg newdocs/docs/tutorials/eajaxtg/paper_files/GoogleDND.png newdocs/docs/tutorials/eajaxtg/paper_files/MyYahooMoveItem.png newdocs/docs/tutorials/eajaxtg/paper_files/SymbolComplete.png newdocs/docs/tutorials/eajaxtg/paper_files/SyntaxHighlighter.css newdocs/docs/tutorials/eajaxtg/paper_files/YahooNews.png newdocs/docs/tutorials/eajaxtg/paper_files/shBrushJScript.js newdocs/docs/tutorials/eajaxtg/paper_files/shBrushPython.js newdocs/docs/tutorials/eajaxtg/paper_files/shBrushXml.js newdocs/docs/tutorials/eajaxtg/paper_files/shCore.js newdocs/docs/tutorials/eajaxtg/paper_files/stevejobs.jpg newdocs/docs/tutorials/todolist/index.html newdocs/docs/tutorials/todolist/tg_tutorial.txt newdocs/docs/tutorials/todolist/todolist.tar.gz newdocs/docs/tutorials/wiki20/20minutess.png newdocs/docs/tutorials/wiki20/index.html newdocs/docs/tutorials/wiki20/page2.html newdocs/docs/tutorials/wiki20/page3.html newdocs/docs/tutorials/wiki20/page4.html newdocs/docs/tutorials/wiki20/page5.html newdocs/docs/tutorials/wiki20/page6.html newdocs/docs/tutorials/wiki20/wiki20.tgz newdocs/docs/tutorials/wikitest/index.html newdocs/download/dltemplate.kid newdocs/download/index.html newdocs/download/install.html newdocs/download/mac.html newdocs/download/nix.html newdocs/download/upgrade.html newdocs/download/windows.html newdocs/images/advance-search.gif newdocs/images/bg1.gif newdocs/images/btn-go.gif newdocs/images/btn-ok.gif newdocs/images/btn-submit.gif newdocs/images/caption.gif newdocs/images/corner_top_left.gif newdocs/images/corner_top_right.gif newdocs/images/curve.jpg newdocs/images/edgecolor.gif newdocs/images/header_bg.gif newdocs/images/header_left.gif newdocs/images/header_logo.gif newdocs/images/header_right.gif newdocs/images/homeimg.jpg newdocs/images/homeimg1.jpg newdocs/images/icon-contact.gif newdocs/images/icon-home.gif newdocs/images/icon-sitemap.gif newdocs/images/img01.jpg newdocs/images/img02.jpg newdocs/images/insidecolor.gif newdocs/images/leftbox-bg.gif newdocs/images/leftbox-bl.gif newdocs/images/leftbox-bottom.gif newdocs/images/leftbox-br.gif newdocs/images/leftbox-tl.gif newdocs/images/leftbox-top.gif newdocs/images/leftbox-tr.gif newdocs/images/loginbg.gif newdocs/images/nav-left.png newdocs/images/nav-right.png newdocs/images/newsletter-bg.gif newdocs/images/newsletter.gif newdocs/images/rightbox-bottom.gif newdocs/images/search-bg.gif newdocs/images/sidebar_bottom_left.gif newdocs/images/sidebar_h1_top_right.gif newdocs/images/skinnyrightbox.gif newdocs/images/trans.gif newdocs/images/welcometxt-bg.jpg newdocs/sh/SyntaxHighlighter.css newdocs/sh/shBrushCSharp.js newdocs/sh/shBrushDelphi.js newdocs/sh/shBrushJScript.js newdocs/sh/shBrushPhp.js newdocs/sh/shBrushPython.js newdocs/sh/shBrushSql.js newdocs/sh/shBrushVb.js newdocs/sh/shBrushXml.js newdocs/sh/shCore.js newdocs/static/css/master.css newdocs/static/css/print.css newdocs/static/images/bg-shadow.png newdocs/static/images/bg-strip.png newdocs/static/images/g-gear.png newdocs/static/images/logo-header.png newdocs/static/images/logo-print.png newdocs/static/images/buttons/download.png newdocs/static/images/buttons/go.png newdocs/static/images/buttons/watch-now.png newdocs/support/index.html newdocs/widgets/index.html plugins/cheetah/README.txt plugins/cheetah/setup.py plugins/cheetah/turbocheetah/__init__.py plugins/cheetah/turbocheetah/cheetahsupport.py plugins/cheetah/turbocheetah/tests/__init__.py plugins/cheetah/turbocheetah/tests/import_inherit.tmpl plugins/cheetah/turbocheetah/tests/inherit_from.tmpl plugins/cheetah/turbocheetah/tests/simple1.tmpl plugins/cheetah/turbocheetah/tests/test_template.py plugins/cheetah/turbocheetah/tests/sub/master.tmpl plugins/cheetah/turbocheetah/tests/sub/page.tmpl plugins/cheetah/turbocheetah/tests/sub/page_over.tmpl plugins/cheetah/turbocheetah/tests/sub/page_template_over.tmpl plugins/cheetah/turbocheetah/tests/sub/template.tmpl plugins/cheetah/turbocheetah/tests/sub/template_over.tmpl plugins/cheetah/turbocheetah/tests/sub2/page_over.tmpl plugins/cheetah/turbocheetah/tests/sub2/template_over.tmpl plugins/fastdata/LICENSE.txt plugins/fastdata/README.txt plugins/fastdata/setup.cfg plugins/fastdata/setup.py plugins/fastdata/tgfastdata/__init__.py plugins/fastdata/tgfastdata/datacontroller.py plugins/fastdata/tgfastdata/datawidgets.py plugins/fastdata/tgfastdata/formmaker.py plugins/fastdata/tgfastdata/plugin.py plugins/fastdata/tgfastdata/release.py plugins/fastdata/tgfastdata/templates/__init__.py plugins/fastdata/tgfastdata/templates/datagrid.kid plugins/fastdata/tgfastdata/templates/form.kid plugins/fastdata/tgfastdata/templates/item.kid plugins/fastdata/tgfastdata/templates/list.kid plugins/fastdata/tgfastdata/templates/master.kid plugins/fastdata/tgfastdata/tests/__init__.py plugins/fastdata/tgfastdata/tests/formmodel.py plugins/fastdata/tgfastdata/tests/test_datacontroller.py plugins/fastdata/tgfastdata/tests/test_fastdata.py plugins/fastdata/tgfastdata/tests/test_formmaker.py plugins/json/README.txt plugins/json/setup.cfg plugins/json/setup.py plugins/json/turbojson/__init__.py plugins/json/turbojson/jsonify.py plugins/json/turbojson/jsonsupport.py plugins/json/turbojson/tests/__init__.py plugins/json/turbojson/tests/test_jsonify.py plugins/kid/README.txt plugins/kid/setup.cfg plugins/kid/setup.py plugins/kid/turbokid/__init__.py plugins/kid/turbokid/kidsupport.py thirdparty/cherrypy/CHANGELOG.txt thirdparty/cherrypy/CHERRYPYTEAM.txt thirdparty/cherrypy/MANIFEST.in thirdparty/cherrypy/README.txt thirdparty/cherrypy/ez_setup.py thirdparty/cherrypy/make-sdist thirdparty/cherrypy/setup.py thirdparty/cherrypy/cherrypy/LICENSE.txt thirdparty/cherrypy/cherrypy/__init__.py thirdparty/cherrypy/cherrypy/_cpcgifs.py thirdparty/cherrypy/cherrypy/_cpengine.py thirdparty/cherrypy/cherrypy/_cperror.py thirdparty/cherrypy/cherrypy/_cphttptools.py thirdparty/cherrypy/cherrypy/_cpserver.py thirdparty/cherrypy/cherrypy/_cpthreadinglocal.py thirdparty/cherrypy/cherrypy/_cptree.py thirdparty/cherrypy/cherrypy/_cputil.py thirdparty/cherrypy/cherrypy/_cpwsgi.py thirdparty/cherrypy/cherrypy/_cpwsgiserver.py thirdparty/cherrypy/cherrypy/config.py thirdparty/cherrypy/cherrypy/favicon.ico thirdparty/cherrypy/cherrypy/filters/__init__.py thirdparty/cherrypy/cherrypy/filters/basefilter.py thirdparty/cherrypy/cherrypy/filters/baseurlfilter.py thirdparty/cherrypy/cherrypy/filters/cachefilter.py thirdparty/cherrypy/cherrypy/filters/decodingfilter.py thirdparty/cherrypy/cherrypy/filters/encodingfilter.py thirdparty/cherrypy/cherrypy/filters/gzipfilter.py thirdparty/cherrypy/cherrypy/filters/logdebuginfofilter.py thirdparty/cherrypy/cherrypy/filters/nsgmlsfilter.py thirdparty/cherrypy/cherrypy/filters/responseheadersfilter.py thirdparty/cherrypy/cherrypy/filters/sessionauthenticatefilter.py thirdparty/cherrypy/cherrypy/filters/sessionfilter.py thirdparty/cherrypy/cherrypy/filters/staticfilter.py thirdparty/cherrypy/cherrypy/filters/tidyfilter.py thirdparty/cherrypy/cherrypy/filters/virtualhostfilter.py thirdparty/cherrypy/cherrypy/filters/wsgiappfilter.py thirdparty/cherrypy/cherrypy/filters/xmlrpcfilter.py thirdparty/cherrypy/cherrypy/lib/__init__.py thirdparty/cherrypy/cherrypy/lib/autoreload.py thirdparty/cherrypy/cherrypy/lib/covercp.py thirdparty/cherrypy/cherrypy/lib/cptools.py thirdparty/cherrypy/cherrypy/lib/defaultformmask.py thirdparty/cherrypy/cherrypy/lib/form.py thirdparty/cherrypy/cherrypy/lib/httptools.py thirdparty/cherrypy/cherrypy/lib/profiler.py thirdparty/cherrypy/cherrypy/lib/filter/__init__.py thirdparty/cherrypy/cherrypy/test/__init__.py thirdparty/cherrypy/cherrypy/test/benchmark.py thirdparty/cherrypy/cherrypy/test/helper.py thirdparty/cherrypy/cherrypy/test/modpy.py thirdparty/cherrypy/cherrypy/test/standalone_test_alt_script_name.py thirdparty/cherrypy/cherrypy/test/style.css thirdparty/cherrypy/cherrypy/test/test.py thirdparty/cherrypy/cherrypy/test/test_baseurl_filter.py thirdparty/cherrypy/cherrypy/test/test_cache_filter.py thirdparty/cherrypy/cherrypy/test/test_combinedfilters.py thirdparty/cherrypy/cherrypy/test/test_config.py thirdparty/cherrypy/cherrypy/test/test_core.py thirdparty/cherrypy/cherrypy/test/test_custom_filters.py thirdparty/cherrypy/cherrypy/test/test_decodingencoding_filter.py thirdparty/cherrypy/cherrypy/test/test_gzip_filter.py thirdparty/cherrypy/cherrypy/test/test_http.py thirdparty/cherrypy/cherrypy/test/test_logdebuginfo_filter.py thirdparty/cherrypy/cherrypy/test/test_noserver.py thirdparty/cherrypy/cherrypy/test/test_objectmapping.py thirdparty/cherrypy/cherrypy/test/test_response_headers_filter.py thirdparty/cherrypy/cherrypy/test/test_session_concurrency.py thirdparty/cherrypy/cherrypy/test/test_session_filter.py thirdparty/cherrypy/cherrypy/test/test_sessionauthenticate_filter.py thirdparty/cherrypy/cherrypy/test/test_states.py thirdparty/cherrypy/cherrypy/test/test_static_filter.py thirdparty/cherrypy/cherrypy/test/test_tutorials.py thirdparty/cherrypy/cherrypy/test/test_virtualhost_filter.py thirdparty/cherrypy/cherrypy/test/test_wsgiapp_filter.py thirdparty/cherrypy/cherrypy/test/test_xmlrpc_filter.py thirdparty/cherrypy/cherrypy/test/webtest.py thirdparty/cherrypy/cherrypy/test/static/dirback.jpg thirdparty/cherrypy/cherrypy/test/static/has space.html thirdparty/cherrypy/cherrypy/test/static/index.html thirdparty/cherrypy/cherrypy/tutorial/README.txt thirdparty/cherrypy/cherrypy/tutorial/__init__.py thirdparty/cherrypy/cherrypy/tutorial/bonus-sqlobject.py thirdparty/cherrypy/cherrypy/tutorial/custom_error.html thirdparty/cherrypy/cherrypy/tutorial/pdf_file.pdf thirdparty/cherrypy/cherrypy/tutorial/tut01_helloworld.py thirdparty/cherrypy/cherrypy/tutorial/tut02_expose_methods.py thirdparty/cherrypy/cherrypy/tutorial/tut03_get_and_post.py thirdparty/cherrypy/cherrypy/tutorial/tut04_complex_site.py thirdparty/cherrypy/cherrypy/tutorial/tut05_derived_objects.py thirdparty/cherrypy/cherrypy/tutorial/tut06_default_method.py thirdparty/cherrypy/cherrypy/tutorial/tut07_sessions.py thirdparty/cherrypy/cherrypy/tutorial/tut08_generators_and_yield.py thirdparty/cherrypy/cherrypy/tutorial/tut09_files.py thirdparty/cherrypy/cherrypy/tutorial/tut10_http_errors.py thirdparty/cherrypy/cherrypy/tutorial/tutorial.conf thirdparty/cherrypy/docs/book/build.sh thirdparty/cherrypy/docs/book/build4xslt.bat thirdparty/cherrypy/docs/book/build4xslt.sh thirdparty/cherrypy/docs/book/css/style.css thirdparty/cherrypy/docs/book/xml/about.xml thirdparty/cherrypy/docs/book/xml/administration.xml thirdparty/cherrypy/docs/book/xml/adminreference.xml thirdparty/cherrypy/docs/book/xml/api.xml thirdparty/cherrypy/docs/book/xml/apireference.xml thirdparty/cherrypy/docs/book/xml/appdeveloperreference.xml thirdparty/cherrypy/docs/book/xml/appendix.xml thirdparty/cherrypy/docs/book/xml/autoreload.gif thirdparty/cherrypy/docs/book/xml/backendoverview.xml thirdparty/cherrypy/docs/book/xml/buildingblog.xml thirdparty/cherrypy/docs/book/xml/builtinfilters.xml thirdparty/cherrypy/docs/book/xml/byexample.xml thirdparty/cherrypy/docs/book/xml/cherrypy.xml thirdparty/cherrypy/docs/book/xml/codingstandards.xml thirdparty/cherrypy/docs/book/xml/codingstyle.xml thirdparty/cherrypy/docs/book/xml/configreference.xml thirdparty/cherrypy/docs/book/xml/configsystemoverview.xml thirdparty/cherrypy/docs/book/xml/configureapplication.xml thirdparty/cherrypy/docs/book/xml/designchoices.xml thirdparty/cherrypy/docs/book/xml/detailedoverview.xml thirdparty/cherrypy/docs/book/xml/developers.xml thirdparty/cherrypy/docs/book/xml/docs.xml thirdparty/cherrypy/docs/book/xml/errorhandling.xml thirdparty/cherrypy/docs/book/xml/errors.gif thirdparty/cherrypy/docs/book/xml/extending.xml thirdparty/cherrypy/docs/book/xml/faq.xml thirdparty/cherrypy/docs/book/xml/fileuploadbehavior.xml thirdparty/cherrypy/docs/book/xml/filtersexplained.xml thirdparty/cherrypy/docs/book/xml/frameworkdeveloperreference.xml thirdparty/cherrypy/docs/book/xml/gettingstarted.xml thirdparty/cherrypy/docs/book/xml/globaloverviewcherrypy.xml thirdparty/cherrypy/docs/book/xml/history.xml thirdparty/cherrypy/docs/book/xml/installapplication.xml thirdparty/cherrypy/docs/book/xml/installation.xml thirdparty/cherrypy/docs/book/xml/introduction.xml thirdparty/cherrypy/docs/book/xml/license.xml thirdparty/cherrypy/docs/book/xml/preface.xml thirdparty/cherrypy/docs/book/xml/process.gif thirdparty/cherrypy/docs/book/xml/productionsetup.xml thirdparty/cherrypy/docs/book/xml/productionsetupservers.xml thirdparty/cherrypy/docs/book/xml/recipes.xml thirdparty/cherrypy/docs/book/xml/reference.xml thirdparty/cherrypy/docs/book/xml/schemas.xml thirdparty/cherrypy/docs/book/xml/serversarchitecture.xml thirdparty/cherrypy/docs/book/xml/sessions.xml thirdparty/cherrypy/docs/book/xml/staticcontenthandling.xml thirdparty/cherrypy/docs/book/xml/support.xml thirdparty/cherrypy/docs/book/xml/templateindependant.xml thirdparty/cherrypy/docs/book/xml/templating.xml thirdparty/cherrypy/docs/book/xml/users.xml thirdparty/cherrypy/docs/book/xml/usingfilters.xml thirdparty/cherrypy/docs/book/xml/whatsnew.xml thirdparty/cherrypy/docs/book/xml/writingfilters.xml thirdparty/cherrypy/docs/book/xsl/chunked.xsl thirdparty/cherrypy/docs/book/xsl/html.xsl thirdparty/cherrypy/docs/book/xsl/htmlhelp.xsl thirdparty/cherrypy/docs/book/xsl/onechunk.xsl thirdparty/cherrypy/docs/europython2005/index.html thirdparty/cherrypy/docs/europython2005/s5/default/blank.gif thirdparty/cherrypy/docs/europython2005/s5/default/bodybg.gif thirdparty/cherrypy/docs/europython2005/s5/default/framing.css thirdparty/cherrypy/docs/europython2005/s5/default/iepngfix.htc thirdparty/cherrypy/docs/europython2005/s5/default/opera.css thirdparty/cherrypy/docs/europython2005/s5/default/outline.css thirdparty/cherrypy/docs/europython2005/s5/default/pngbehavior.htc thirdparty/cherrypy/docs/europython2005/s5/default/pretty.css thirdparty/cherrypy/docs/europython2005/s5/default/print.css thirdparty/cherrypy/docs/europython2005/s5/default/s5-core.css thirdparty/cherrypy/docs/europython2005/s5/default/slides-cc.js thirdparty/cherrypy/docs/europython2005/s5/default/slides.css thirdparty/cherrypy/docs/europython2005/s5/default/slides.js thirdparty/cherrypy/docs/europython2005/s5/theme/bg-shade.png thirdparty/cherrypy/docs/europython2005/s5/theme/bg-slide.jpg thirdparty/cherrypy/docs/europython2005/s5/theme/cherryPyLogo.png thirdparty/cherrypy/docs/europython2005/s5/theme/framing.css thirdparty/cherrypy/docs/europython2005/s5/theme/pretty.css thirdparty/cherrypy/docs/europython2005/s5/theme/s5-core.css thirdparty/cherrypy/docs/europython2005/s5/theme/slides.css thirdparty/cherrypy/docs/london-meetup-20051212/index.html thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/blank.gif thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/bodybg.gif thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/framing.css thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/iepngfix.htc thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/opera.css thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/outline.css thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/pngbehavior.htc thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/pretty.css thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/print.css thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/s5-core.css thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/slides-cc.js thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/slides.css thirdparty/cherrypy/docs/london-meetup-20051212/s5/default/slides.js thirdparty/cherrypy/docs/london-meetup-20051212/s5/theme/bg-shade.png thirdparty/cherrypy/docs/london-meetup-20051212/s5/theme/bg-slide.jpg thirdparty/cherrypy/docs/london-meetup-20051212/s5/theme/cherryPyLogo.png thirdparty/cherrypy/docs/london-meetup-20051212/s5/theme/framing.css thirdparty/cherrypy/docs/london-meetup-20051212/s5/theme/pretty.css thirdparty/cherrypy/docs/london-meetup-20051212/s5/theme/s5-core.css thirdparty/cherrypy/docs/london-meetup-20051212/s5/theme/slides.css thirdparty/cherrypy/tools/linefeed.py thirdparty/cherrypy/tools/docbook/docbook-4.5b1.tgz thirdparty/cherrypy/tools/docbook/docbook-xsl-1.68.1.tar.gz thirdparty/cherrypy/visuals/cherrypy_logo_big.png thirdparty/cherrypy/visuals/cherrypy_logo_small.jpg thirdparty/cherrypy/visuals/favicon.ico thirdparty/cherrypy/visuals/made_with_cherrypy_big.png thirdparty/cherrypy/visuals/made_with_cherrypy_small.png thirdparty/formencode/MANIFEST.in thirdparty/formencode/setup.cfg thirdparty/formencode/setup.py thirdparty/formencode/docs/Design.txt thirdparty/formencode/docs/ToDo.txt thirdparty/formencode/docs/Validator.txt thirdparty/formencode/docs/build thirdparty/formencode/docs/community.txt thirdparty/formencode/docs/default.css thirdparty/formencode/docs/download.txt thirdparty/formencode/docs/history.txt thirdparty/formencode/docs/htmlfill.txt thirdparty/formencode/docs/index.txt thirdparty/formencode/docs/news.txt thirdparty/formencode/docs/test_docs.py thirdparty/formencode/examples/webware_example.ini thirdparty/formencode/examples/WebwareExamples/__init__.py thirdparty/formencode/examples/WebwareExamples/index.py thirdparty/formencode/ez_setup/README.txt thirdparty/formencode/ez_setup/__init__.py thirdparty/formencode/formencode/__init__.py thirdparty/formencode/formencode/api.py thirdparty/formencode/formencode/compound.py thirdparty/formencode/formencode/context.py thirdparty/formencode/formencode/declarative.py thirdparty/formencode/formencode/doctest_xml_compare.py thirdparty/formencode/formencode/fields.py thirdparty/formencode/formencode/fieldstorage.py thirdparty/formencode/formencode/foreach.py thirdparty/formencode/formencode/formgen.py thirdparty/formencode/formencode/htmlfill.py thirdparty/formencode/formencode/htmlfill_schemabuilder.py thirdparty/formencode/formencode/htmlform.py thirdparty/formencode/formencode/htmlgen.py thirdparty/formencode/formencode/interfaces.py thirdparty/formencode/formencode/schema.py thirdparty/formencode/formencode/sqlformgen.py thirdparty/formencode/formencode/sqlschema.py thirdparty/formencode/formencode/validators.py thirdparty/formencode/formencode/variabledecode.py thirdparty/formencode/formencode/javascript/ordering.js thirdparty/formencode/formencode/util/__init__.py thirdparty/formencode/formencode/util/doctest24.py thirdparty/formencode/formencode/util/threadinglocal.py thirdparty/formencode/tests/conftest.py thirdparty/formencode/tests/non_empty.txt thirdparty/formencode/tests/test_cc_expires.py thirdparty/formencode/tests/test_cc_validator.py thirdparty/formencode/tests/test_context.py thirdparty/formencode/tests/test_doctest_xml_compare.py thirdparty/formencode/tests/test_doctests.py thirdparty/formencode/tests/test_formgen.py thirdparty/formencode/tests/test_htmlfill.py thirdparty/formencode/tests/test_htmlgen.py thirdparty/formencode/tests/test_makeform.py thirdparty/formencode/tests/test_schema.py thirdparty/formencode/tests/test_sqlschema.py thirdparty/formencode/tests/htmlfill_data/data-error1.txt thirdparty/formencode/tests/htmlfill_data/data-fill1.txt thirdparty/formencode/tests/htmlfill_data/data-fill2.txt thirdparty/formencode/tests/htmlfill_data/data-fill3.txt thirdparty/formencode/tests/htmlfill_data/data-fill4.txt thirdparty/formencode/tests/htmlfill_data/data-schema1.txt thirdparty/kid/COPYING thirdparty/kid/ChangeLog thirdparty/kid/HISTORY thirdparty/kid/MANIFEST.in thirdparty/kid/README thirdparty/kid/RELEASING thirdparty/kid/ez_setup.py thirdparty/kid/makefile thirdparty/kid/setup.cfg thirdparty/kid/setup.py thirdparty/kid/test_kid.py thirdparty/kid/work.sh thirdparty/kid/bin/kid thirdparty/kid/bin/kidc thirdparty/kid/doc/custom.css thirdparty/kid/doc/default.css thirdparty/kid/doc/guide.txt thirdparty/kid/doc/index.txt thirdparty/kid/doc/language.txt thirdparty/kid/doc/makefile thirdparty/kid/doc/notes.txt thirdparty/kid/examples/basic/README thirdparty/kid/examples/basic/self.kid thirdparty/kid/examples/basic/sysinfo.kid thirdparty/kid/examples/basic/tutorial.kid thirdparty/kid/examples/basic/tutorial2.kid thirdparty/kid/examples/cgi/README thirdparty/kid/examples/cgi/kid_handler.cgi thirdparty/kid/examples/cgi/sysinfo.kid thirdparty/kid/kid/__init__.py thirdparty/kid/kid/compile.py thirdparty/kid/kid/compiler.py thirdparty/kid/kid/et.py thirdparty/kid/kid/filter.py thirdparty/kid/kid/importer.py thirdparty/kid/kid/namespace.py thirdparty/kid/kid/parser.py thirdparty/kid/kid/pull.py thirdparty/kid/kid/release.py thirdparty/kid/kid/run.py thirdparty/kid/kid/serialization.py thirdparty/kid/kid/server.py thirdparty/kid/kid/template_util.py thirdparty/kid/kid/util.py thirdparty/kid/kid.egg-info/PKG-INFO thirdparty/kid/kid/test/__init__.py thirdparty/kid/kid/test/test_comment.py thirdparty/kid/kid/test/test_compiler.py thirdparty/kid/kid/test/test_kid.py thirdparty/kid/kid/test/test_kid_lang.py thirdparty/kid/kid/test/test_layout.py thirdparty/kid/kid/test/test_match.py thirdparty/kid/kid/test/test_namespace.py thirdparty/kid/kid/test/test_parser.py thirdparty/kid/kid/test/test_pull.py thirdparty/kid/kid/test/test_scope.py thirdparty/kid/kid/test/test_serialization.py thirdparty/kid/kid/test/test_suffixes.py thirdparty/kid/kid/test/test_templatepath.py thirdparty/kid/kid/test/test_unicode.py thirdparty/kid/kid/test/util.py thirdparty/kid/misc/upgrade-0.6.py thirdparty/kid/test/__init__.py thirdparty/kid/test/basic-test.html.kid thirdparty/kid/test/blocks.py thirdparty/kid/test/context.kid thirdparty/kid/test/include-me.xml thirdparty/kid/test/layout.kid thirdparty/kid/test/serialization.kid thirdparty/kid/test/template-test.html.kid thirdparty/kid/test/templates.kid thirdparty/kid/test/test_attribute_interpolation.kid thirdparty/kid/test/test_attrs.kid thirdparty/kid/test/test_backward.kid thirdparty/kid/test/test_comment_pi.kid thirdparty/kid/test/test_content.kid thirdparty/kid/test/test_content_interpolation.kid thirdparty/kid/test/test_content_structure.kid thirdparty/kid/test/test_def.kid thirdparty/kid/test/test_encoding.kid thirdparty/kid/test/test_entities.kid thirdparty/kid/test/test_extends.kid thirdparty/kid/test/test_if.kid thirdparty/kid/test/test_kid_pi.kid thirdparty/kid/test/test_layout_page.kid thirdparty/kid/test/test_match.kid thirdparty/kid/test/test_match_parent.kid thirdparty/kid/test/test_namespaces.kid thirdparty/kid/test/test_omit.kid thirdparty/kid/test/test_repeat.kid thirdparty/kid/test/test_replace.kid thirdparty/mochikit/LICENSE.txt thirdparty/mochikit/MochiKit/Async.js thirdparty/mochikit/MochiKit/Base.js thirdparty/mochikit/MochiKit/Color.js thirdparty/mochikit/MochiKit/DOM.js thirdparty/mochikit/MochiKit/DateTime.js thirdparty/mochikit/MochiKit/Format.js thirdparty/mochikit/MochiKit/Iter.js thirdparty/mochikit/MochiKit/Logging.js thirdparty/mochikit/MochiKit/LoggingPane.js thirdparty/mochikit/MochiKit/MochiKit.js thirdparty/mochikit/MochiKit/MockDOM.js thirdparty/mochikit/MochiKit/Signal.js thirdparty/mochikit/MochiKit/Test.js thirdparty/mochikit/MochiKit/Visual.js thirdparty/mochikit/MochiKit/__package__.js thirdparty/mochikit/doc/html/MochiKit/Async.html thirdparty/mochikit/doc/html/MochiKit/Base.html thirdparty/mochikit/doc/html/MochiKit/Color.html thirdparty/mochikit/doc/html/MochiKit/DOM.html thirdparty/mochikit/doc/html/MochiKit/DateTime.html thirdparty/mochikit/doc/html/MochiKit/Format.html thirdparty/mochikit/doc/html/MochiKit/Iter.html thirdparty/mochikit/doc/html/MochiKit/Logging.html thirdparty/mochikit/doc/html/MochiKit/LoggingPane.html thirdparty/mochikit/doc/html/MochiKit/Signal.html thirdparty/mochikit/doc/html/MochiKit/VersionHistory.html thirdparty/mochikit/doc/html/MochiKit/Visual.html thirdparty/mochikit/doc/html/MochiKit/index.html thirdparty/mochikit/doc/js/toc.js thirdparty/mochikit/doc/rst/MochiKit/Async.rst thirdparty/mochikit/doc/rst/MochiKit/Base.rst thirdparty/mochikit/doc/rst/MochiKit/Color.rst thirdparty/mochikit/doc/rst/MochiKit/DOM.rst thirdparty/mochikit/doc/rst/MochiKit/DateTime.rst thirdparty/mochikit/doc/rst/MochiKit/Format.rst thirdparty/mochikit/doc/rst/MochiKit/Iter.rst thirdparty/mochikit/doc/rst/MochiKit/Logging.rst thirdparty/mochikit/doc/rst/MochiKit/LoggingPane.rst thirdparty/mochikit/doc/rst/MochiKit/Signal.rst thirdparty/mochikit/doc/rst/MochiKit/VersionHistory.rst thirdparty/mochikit/doc/rst/MochiKit/Visual.rst thirdparty/mochikit/doc/rst/MochiKit/index.rst thirdparty/mochikit/examples/ajax_tables/ajax_tables.css thirdparty/mochikit/examples/ajax_tables/ajax_tables.js thirdparty/mochikit/examples/ajax_tables/domains.json thirdparty/mochikit/examples/ajax_tables/domains.xml thirdparty/mochikit/examples/ajax_tables/index.html thirdparty/mochikit/examples/color_wheel/color_wheel.css thirdparty/mochikit/examples/color_wheel/color_wheel.js thirdparty/mochikit/examples/color_wheel/index.html thirdparty/mochikit/examples/draggable/draggable.css thirdparty/mochikit/examples/draggable/draggable.js thirdparty/mochikit/examples/draggable/index.html thirdparty/mochikit/examples/interpreter/index.html thirdparty/mochikit/examples/interpreter/interpreter.css thirdparty/mochikit/examples/interpreter/interpreter.js thirdparty/mochikit/examples/key_events/index.html thirdparty/mochikit/examples/key_events/key_events.css thirdparty/mochikit/examples/key_events/key_events.js thirdparty/mochikit/examples/logging_pane/index.html thirdparty/mochikit/examples/logging_pane/logging_pane.css thirdparty/mochikit/examples/logging_pane/logging_pane.js thirdparty/mochikit/examples/mochiregexp/index.html thirdparty/mochikit/examples/mochiregexp/mochiregexp.css thirdparty/mochikit/examples/mochiregexp/mochiregexp.js thirdparty/mochikit/examples/rounded_corners/index.html thirdparty/mochikit/examples/rounded_corners/rounded_corners.css thirdparty/mochikit/examples/rounded_corners/rounded_corners.js thirdparty/mochikit/examples/sortable_tables/index.html thirdparty/mochikit/examples/sortable_tables/sortable_tables.css thirdparty/mochikit/examples/sortable_tables/sortable_tables.js thirdparty/mochikit/examples/view-source/view-source.css thirdparty/mochikit/examples/view-source/view-source.html thirdparty/mochikit/examples/view-source/view-source.js thirdparty/mochikit/examples/view-source/lib/SyntaxHighlighter/SyntaxHighlighter.css thirdparty/mochikit/examples/view-source/lib/SyntaxHighlighter/Tests.html thirdparty/mochikit/examples/view-source/lib/SyntaxHighlighter/shBrushCSharp.js thirdparty/mochikit/examples/view-source/lib/SyntaxHighlighter/shBrushDelphi.js thirdparty/mochikit/examples/view-source/lib/SyntaxHighlighter/shBrushJScript.js thirdparty/mochikit/examples/view-source/lib/SyntaxHighlighter/shBrushPhp.js thirdparty/mochikit/examples/view-source/lib/SyntaxHighlighter/shBrushPython.js thirdparty/mochikit/examples/view-source/lib/SyntaxHighlighter/shBrushSql.js thirdparty/mochikit/examples/view-source/lib/SyntaxHighlighter/shBrushVb.js thirdparty/mochikit/examples/view-source/lib/SyntaxHighlighter/shBrushXml.js thirdparty/mochikit/examples/view-source/lib/SyntaxHighlighter/shCore.js thirdparty/mochikit/include/css/documentation.css thirdparty/mochikit/include/css/general.css thirdparty/mochikit/packed/MochiKit/MochiKit.js thirdparty/mochikit/packed/MochiKit/__package__.js thirdparty/mochikit/scripts/build.py thirdparty/mochikit/scripts/custom_rhino.jar thirdparty/mochikit/scripts/make_docs.py thirdparty/mochikit/scripts/pack.py thirdparty/mochikit/scripts/spidermochi.js thirdparty/mochikit/tests/index.html thirdparty/mochikit/tests/test_Base.js thirdparty/mochikit/tests/test_Color.js thirdparty/mochikit/tests/test_DateTime.js thirdparty/mochikit/tests/test_Format.js thirdparty/mochikit/tests/test_Iter.js thirdparty/mochikit/tests/test_Logging.js thirdparty/mochikit/tests/test_MochiKit-Async.html thirdparty/mochikit/tests/test_MochiKit-Base.html thirdparty/mochikit/tests/test_MochiKit-Color.html thirdparty/mochikit/tests/test_MochiKit-DOM.html thirdparty/mochikit/tests/test_MochiKit-DateTime.html thirdparty/mochikit/tests/test_MochiKit-Format.html thirdparty/mochikit/tests/test_MochiKit-Iter.html thirdparty/mochikit/tests/test_MochiKit-JSAN.html thirdparty/mochikit/tests/test_MochiKit-Logging.html thirdparty/mochikit/tests/test_MochiKit-MochiKit.html thirdparty/mochikit/tests/test_MochiKit-Signal.html thirdparty/mochikit/tests/test_Signal.js thirdparty/mochikit/tests/SimpleTest/SimpleTest.js thirdparty/mochikit/tests/SimpleTest/TestRunner.js thirdparty/mochikit/tests/SimpleTest/test.css thirdparty/paste/setup.cfg thirdparty/paste/setup.py thirdparty/paste/docs/DeveloperGuidelines.txt thirdparty/paste/docs/StyleGuide.txt thirdparty/paste/docs/default.css thirdparty/paste/docs/develop-example.txt thirdparty/paste/docs/developer-features.txt thirdparty/paste/docs/do-it-yourself-framework.txt thirdparty/paste/docs/doc.conf thirdparty/paste/docs/enabled.txt thirdparty/paste/docs/index.txt thirdparty/paste/docs/install-example.txt thirdparty/paste/docs/news.txt thirdparty/paste/docs/package_index.txt thirdparty/paste/docs/rebuild thirdparty/paste/docs/related-projects.txt thirdparty/paste/docs/template.tmpl thirdparty/paste/docs/testing-applications.txt thirdparty/paste/docs/url-parsing-with-wsgi.txt thirdparty/paste/docs/community/index.txt thirdparty/paste/docs/community/mailing-list.txt thirdparty/paste/docs/community/repository.txt thirdparty/paste/docs/download/index.txt thirdparty/paste/docs/include/contact.txt thirdparty/paste/docs/include/reference_header.txt thirdparty/paste/docs/web/default-site.css thirdparty/paste/docs/web/index.txt thirdparty/paste/docs/web/site.js thirdparty/paste/docs/web/style.css thirdparty/paste/paste/__init__.py thirdparty/paste/paste/cascade.py thirdparty/paste/paste/cgiapp.py thirdparty/paste/paste/cgitb_catcher.py thirdparty/paste/paste/error_document.py thirdparty/paste/paste/errordocument.py thirdparty/paste/paste/fileapp.py thirdparty/paste/paste/fixture.py thirdparty/paste/paste/flup_session.py thirdparty/paste/paste/gzipper.py thirdparty/paste/paste/httpexceptions.py thirdparty/paste/paste/httpheaders.py thirdparty/paste/paste/httpserver.py thirdparty/paste/paste/lint.py thirdparty/paste/paste/printdebug.py thirdparty/paste/paste/profilemiddleware.py thirdparty/paste/paste/progress.py thirdparty/paste/paste/proxy.py thirdparty/paste/paste/recursive.py thirdparty/paste/paste/reloader.py thirdparty/paste/paste/request.py thirdparty/paste/paste/response.py thirdparty/paste/paste/session.py thirdparty/paste/paste/transaction.py thirdparty/paste/paste/translogger.py thirdparty/paste/paste/url.py thirdparty/paste/paste/urlmap.py thirdparty/paste/paste/urlparser.py thirdparty/paste/paste/wdg_validate.py thirdparty/paste/paste/wsgilib.py thirdparty/paste/paste/auth/__init__.py thirdparty/paste/paste/auth/auth_tkt.py thirdparty/paste/paste/auth/basic.py thirdparty/paste/paste/auth/cas.py thirdparty/paste/paste/auth/cookie.py thirdparty/paste/paste/auth/digest.py thirdparty/paste/paste/auth/form.py thirdparty/paste/paste/auth/grantip.py thirdparty/paste/paste/auth/multi.py thirdparty/paste/paste/auth/open_id.py thirdparty/paste/paste/debug/__init__.py thirdparty/paste/paste/debug/debugapp.py thirdparty/paste/paste/debug/doctest_webapp.py thirdparty/paste/paste/debug/fsdiff.py thirdparty/paste/paste/debug/prints.py thirdparty/paste/paste/debug/profile.py thirdparty/paste/paste/debug/testserver.py thirdparty/paste/paste/debug/wdg_validate.py thirdparty/paste/paste/evalexception/__init__.py thirdparty/paste/paste/evalexception/evalcontext.py thirdparty/paste/paste/evalexception/middleware.py thirdparty/paste/paste/evalexception/media/debug.js thirdparty/paste/paste/evalexception/media/minus.jpg thirdparty/paste/paste/evalexception/media/plus.jpg thirdparty/paste/paste/evalexception/mochikit/MochiKit.js thirdparty/paste/paste/evalexception/mochikit/__package__.js thirdparty/paste/paste/exceptions/__init__.py thirdparty/paste/paste/exceptions/collector.py thirdparty/paste/paste/exceptions/errormiddleware.py thirdparty/paste/paste/exceptions/formatter.py thirdparty/paste/paste/exceptions/reporter.py thirdparty/paste/paste/exceptions/serial_number_generator.py thirdparty/paste/paste/util/PySourceColor.py thirdparty/paste/paste/util/UserDict24.py thirdparty/paste/paste/util/__init__.py thirdparty/paste/paste/util/classinit.py thirdparty/paste/paste/util/classinstance.py thirdparty/paste/paste/util/dateinterval.py thirdparty/paste/paste/util/datetimeutil.py thirdparty/paste/paste/util/doctest24.py thirdparty/paste/paste/util/filemixin.py thirdparty/paste/paste/util/finddata.py thirdparty/paste/paste/util/findpackage.py thirdparty/paste/paste/util/import_string.py thirdparty/paste/paste/util/intset.py thirdparty/paste/paste/util/ip4.py thirdparty/paste/paste/util/quoting.py thirdparty/paste/paste/util/scgiserver.py thirdparty/paste/paste/util/string24.py thirdparty/paste/paste/util/subprocess24.py thirdparty/paste/paste/util/threadedprint.py thirdparty/paste/paste/util/threadinglocal.py thirdparty/paste/tests/conftest.py thirdparty/paste/tests/test_cgiapp.py thirdparty/paste/tests/test_cgitb_catcher.py thirdparty/paste/tests/test_errordocument.py thirdparty/paste/tests/test_fileapp.py thirdparty/paste/tests/test_grantip.py thirdparty/paste/tests/test_httpheaders.py thirdparty/paste/tests/test_import_string.py thirdparty/paste/tests/test_profilemiddleware.py thirdparty/paste/tests/test_proxy.py thirdparty/paste/tests/test_request.py thirdparty/paste/tests/test_urlmap.py thirdparty/paste/tests/test_urlparser.py thirdparty/paste/tests/cgiapp_data/error.cgi thirdparty/paste/tests/cgiapp_data/form.cgi thirdparty/paste/tests/cgiapp_data/ok.cgi thirdparty/paste/tests/cgiapp_data/stderr.cgi thirdparty/paste/tests/test_auth/test_auth_cookie.py thirdparty/paste/tests/test_auth/test_auth_digest.py thirdparty/paste/tests/test_exceptions/__init__.py thirdparty/paste/tests/test_exceptions/test_error_middleware.py thirdparty/paste/tests/test_exceptions/test_formatter.py thirdparty/paste/tests/test_exceptions/test_httpexceptions.py thirdparty/paste/tests/test_exceptions/test_reporter.py thirdparty/paste/tests/test_util/test_datetimeutil.py thirdparty/paste/tests/urlparser_data/__init__.py thirdparty/paste/tests/urlparser_data/deep/index.html thirdparty/paste/tests/urlparser_data/deep/sub/Main.txt thirdparty/paste/tests/urlparser_data/find_file/index.txt thirdparty/paste/tests/urlparser_data/find_file/test2.html thirdparty/paste/tests/urlparser_data/hook/__init__.py thirdparty/paste/tests/urlparser_data/hook/app.py thirdparty/paste/tests/urlparser_data/hook/index.py thirdparty/paste/tests/urlparser_data/not_found/__init__.py thirdparty/paste/tests/urlparser_data/not_found/recur/__init__.py thirdparty/paste/tests/urlparser_data/not_found/recur/isfound.txt thirdparty/paste/tests/urlparser_data/not_found/simple/__init__.py thirdparty/paste/tests/urlparser_data/not_found/simple/found.txt thirdparty/paste/tests/urlparser_data/not_found/user/__init__.py thirdparty/paste/tests/urlparser_data/not_found/user/list.py thirdparty/paste/tests/urlparser_data/python/__init__.py thirdparty/paste/tests/urlparser_data/python/simpleapp.py thirdparty/paste/tests/urlparser_data/python/stream.py thirdparty/paste/tests/urlparser_data/python/sub/__init__.py thirdparty/paste/tests/urlparser_data/python/sub/simpleapp.py thirdparty/pastescript/setup.cfg thirdparty/pastescript/setup.py thirdparty/pastescript/docs/developer.txt thirdparty/pastescript/docs/example_cgi_app.ini thirdparty/pastescript/docs/example_wsgiutils_app.ini thirdparty/pastescript/docs/index.txt thirdparty/pastescript/docs/news.txt thirdparty/pastescript/paste/__init__.py thirdparty/pastescript/paste/script/__init__.py thirdparty/pastescript/paste/script/appinstall.py thirdparty/pastescript/paste/script/bool_optparse.py thirdparty/pastescript/paste/script/cgi_server.py thirdparty/pastescript/paste/script/checkperms.py thirdparty/pastescript/paste/script/command.py thirdparty/pastescript/paste/script/copydir.py thirdparty/pastescript/paste/script/create_distro.py thirdparty/pastescript/paste/script/default_sysconfig.py thirdparty/pastescript/paste/script/entrypoints.py thirdparty/pastescript/paste/script/exe.py thirdparty/pastescript/paste/script/filemaker.py thirdparty/pastescript/paste/script/flup_server.py thirdparty/pastescript/paste/script/grep.py thirdparty/pastescript/paste/script/help.py thirdparty/pastescript/paste/script/interfaces.py thirdparty/pastescript/paste/script/pluginlib.py thirdparty/pastescript/paste/script/serve.py thirdparty/pastescript/paste/script/templates.py thirdparty/pastescript/paste/script/testapp.py thirdparty/pastescript/paste/script/twisted_web2_server.py thirdparty/pastescript/paste/script/wsgiutils_server.py thirdparty/pastescript/paste/script/templates/basic_package/setup.cfg thirdparty/pastescript/paste/script/templates/basic_package/setup.py_tmpl thirdparty/pastescript/paste/script/templates/basic_package/+package+/__init__.py thirdparty/pastescript/paste/script/util/__init__.py thirdparty/pastescript/paste/script/util/secret.py thirdparty/pastescript/paste/script/util/string24.py thirdparty/pastescript/paste/script/util/subprocess24.py thirdparty/pastescript/paste/script/util/uuid.py thirdparty/pastescript/scripts/paster thirdparty/pastescript/tests/conftest.py thirdparty/pastescript/tests/test_egg_finder.py thirdparty/pastescript/tests/test_plugin_adder.py thirdparty/pastescript/tests/test_template_introspect.py thirdparty/pastescript/tests/appsetup/test_make_project.py thirdparty/pastescript/tests/appsetup/testfiles/admin_index.py thirdparty/pastescript/tests/appsetup/testfiles/conftest.py thirdparty/pastescript/tests/appsetup/testfiles/iscape.txt thirdparty/pastescript/tests/appsetup/testfiles/test_forbidden.py thirdparty/pastescript/tests/fake_packages/FakePlugin.egg/setup.py thirdparty/pastescript/tests/fake_packages/FakePlugin.egg/FakePlugin.egg-info/PKG-INFO thirdparty/pastescript/tests/fake_packages/FakePlugin.egg/FakePlugin.egg-info/entry_points.txt thirdparty/pastescript/tests/fake_packages/FakePlugin.egg/FakePlugin.egg-info/paster_plugins.txt thirdparty/pastescript/tests/fake_packages/FakePlugin.egg/FakePlugin.egg-info/top_level.txt thirdparty/pastescript/tests/fake_packages/FakePlugin.egg/fakeplugin/__init__.py thirdparty/pastescript/tests/sample_templates/test1.txt thirdparty/pastescript/tests/sample_templates/test2.py_tmpl thirdparty/pastescript/tests/sample_templates/test3.ini_tmpl thirdparty/pastescript/tests/sample_templates/test4.html_tmpl thirdparty/sqlobject/MANIFEST.in thirdparty/sqlobject/README.txt thirdparty/sqlobject/release thirdparty/sqlobject/setup.cfg thirdparty/sqlobject/setup.py thirdparty/sqlobject/debian/changelog thirdparty/sqlobject/debian/control thirdparty/sqlobject/debian/copyright thirdparty/sqlobject/debian/docs thirdparty/sqlobject/debian/examples thirdparty/sqlobject/debian/rules thirdparty/sqlobject/docs/Authors.txt thirdparty/sqlobject/docs/DeveloperGuide.txt thirdparty/sqlobject/docs/FAQ.txt thirdparty/sqlobject/docs/Inheritance.txt thirdparty/sqlobject/docs/News.txt thirdparty/sqlobject/docs/SQLBuilder.txt thirdparty/sqlobject/docs/SQLObject.txt thirdparty/sqlobject/docs/TODO.txt thirdparty/sqlobject/docs/community.txt thirdparty/sqlobject/docs/default.css thirdparty/sqlobject/docs/download.txt thirdparty/sqlobject/docs/index.txt thirdparty/sqlobject/docs/interface.py thirdparty/sqlobject/docs/links.txt thirdparty/sqlobject/docs/rebuild thirdparty/sqlobject/docs/sqlobject-admin.txt thirdparty/sqlobject/docs/test.py thirdparty/sqlobject/docs/europython/europython_sqlobj.py thirdparty/sqlobject/docs/europython/main.css thirdparty/sqlobject/docs/europython/person.py thirdparty/sqlobject/docs/presentation-2004-11/sqlobject-and-database-programming.html thirdparty/sqlobject/docs/presentation-2004-11/ui/bodybg.gif thirdparty/sqlobject/docs/presentation-2004-11/ui/custom.css thirdparty/sqlobject/docs/presentation-2004-11/ui/framing.css thirdparty/sqlobject/docs/presentation-2004-11/ui/opera.css thirdparty/sqlobject/docs/presentation-2004-11/ui/pretty.css thirdparty/sqlobject/docs/presentation-2004-11/ui/print.css thirdparty/sqlobject/docs/presentation-2004-11/ui/s5-core.css thirdparty/sqlobject/docs/presentation-2004-11/ui/slides.css thirdparty/sqlobject/docs/presentation-2004-11/ui/slides.js thirdparty/sqlobject/ez_setup/README.txt thirdparty/sqlobject/ez_setup/__init__.py thirdparty/sqlobject/scripts/sqlobject-admin thirdparty/sqlobject/sqlobject/__init__.py thirdparty/sqlobject/sqlobject/boundattributes.py thirdparty/sqlobject/sqlobject/cache.py thirdparty/sqlobject/sqlobject/classregistry.py thirdparty/sqlobject/sqlobject/col.py thirdparty/sqlobject/sqlobject/conftest.py thirdparty/sqlobject/sqlobject/constraints.py thirdparty/sqlobject/sqlobject/converters.py thirdparty/sqlobject/sqlobject/dbconnection.py thirdparty/sqlobject/sqlobject/declarative.py thirdparty/sqlobject/sqlobject/index.py thirdparty/sqlobject/sqlobject/joins.py thirdparty/sqlobject/sqlobject/main.py thirdparty/sqlobject/sqlobject/sqlbuilder.py thirdparty/sqlobject/sqlobject/sresults.py thirdparty/sqlobject/sqlobject/styles.py thirdparty/sqlobject/sqlobject/firebird/__init__.py thirdparty/sqlobject/sqlobject/firebird/firebirdconnection.py thirdparty/sqlobject/sqlobject/inheritance/__init__.py thirdparty/sqlobject/sqlobject/inheritance/iteration.py thirdparty/sqlobject/sqlobject/inheritance/tests/__init__.py thirdparty/sqlobject/sqlobject/inheritance/tests/test_deep_inheritance.py thirdparty/sqlobject/sqlobject/inheritance/tests/test_inheritance.py thirdparty/sqlobject/sqlobject/inheritance/tests/test_inherited_foreignKey.py thirdparty/sqlobject/sqlobject/manager/__init__.py thirdparty/sqlobject/sqlobject/manager/command.py thirdparty/sqlobject/sqlobject/maxdb/__init__.py thirdparty/sqlobject/sqlobject/maxdb/maxdbconnection.py thirdparty/sqlobject/sqlobject/maxdb/readme.txt thirdparty/sqlobject/sqlobject/mssql/__init__.py thirdparty/sqlobject/sqlobject/mssql/mssqlconnection.py thirdparty/sqlobject/sqlobject/mysql/__init__.py thirdparty/sqlobject/sqlobject/mysql/mysqlconnection.py thirdparty/sqlobject/sqlobject/postgres/__init__.py thirdparty/sqlobject/sqlobject/postgres/pgconnection.py thirdparty/sqlobject/sqlobject/sqlite/__init__.py thirdparty/sqlobject/sqlobject/sqlite/sqliteconnection.py thirdparty/sqlobject/sqlobject/sybase/__init__.py thirdparty/sqlobject/sqlobject/sybase/sybaseconnection.py thirdparty/sqlobject/sqlobject/tests/__init__.py thirdparty/sqlobject/sqlobject/tests/dbtest.py thirdparty/sqlobject/sqlobject/tests/test_NoneValuedResultItem.py thirdparty/sqlobject/sqlobject/tests/test_SQLMultipleJoin.py thirdparty/sqlobject/sqlobject/tests/test_SQLRelatedJoin.py thirdparty/sqlobject/sqlobject/tests/test_SingleJoin.py thirdparty/sqlobject/sqlobject/tests/test_aliases.py thirdparty/sqlobject/sqlobject/tests/test_auto.py thirdparty/sqlobject/sqlobject/tests/test_auto_old.py thirdparty/sqlobject/sqlobject/tests/test_basic.py thirdparty/sqlobject/sqlobject/tests/test_basic_old.py thirdparty/sqlobject/sqlobject/tests/test_blob.py thirdparty/sqlobject/sqlobject/tests/test_boundattributes.py thirdparty/sqlobject/sqlobject/tests/test_cache.py thirdparty/sqlobject/sqlobject/tests/test_constraints.py thirdparty/sqlobject/sqlobject/tests/test_converters.py thirdparty/sqlobject/sqlobject/tests/test_create_drop.py thirdparty/sqlobject/sqlobject/tests/test_datetime.py thirdparty/sqlobject/sqlobject/tests/test_decimal.py thirdparty/sqlobject/sqlobject/tests/test_declarative.py thirdparty/sqlobject/sqlobject/tests/test_delete.py thirdparty/sqlobject/sqlobject/tests/test_distinct.py thirdparty/sqlobject/sqlobject/tests/test_empty.py thirdparty/sqlobject/sqlobject/tests/test_enum.py thirdparty/sqlobject/sqlobject/tests/test_expire.py thirdparty/sqlobject/sqlobject/tests/test_foreignKey.py thirdparty/sqlobject/sqlobject/tests/test_indexes.py thirdparty/sqlobject/sqlobject/tests/test_inheritance.py thirdparty/sqlobject/sqlobject/tests/test_joins.py thirdparty/sqlobject/sqlobject/tests/test_joins_conditional.py thirdparty/sqlobject/sqlobject/tests/test_joins_old.py thirdparty/sqlobject/sqlobject/tests/test_lazy.py thirdparty/sqlobject/sqlobject/tests/test_minmax.py thirdparty/sqlobject/sqlobject/tests/test_parse.py thirdparty/sqlobject/sqlobject/tests/test_picklecol.py thirdparty/sqlobject/sqlobject/tests/test_reparent_sqlmeta.py thirdparty/sqlobject/sqlobject/tests/test_select.py thirdparty/sqlobject/sqlobject/tests/test_setters.py thirdparty/sqlobject/sqlobject/tests/test_slice.py thirdparty/sqlobject/sqlobject/tests/test_sorting.py thirdparty/sqlobject/sqlobject/tests/test_sorting_old.py thirdparty/sqlobject/sqlobject/tests/test_sqlite_threaded.py thirdparty/sqlobject/sqlobject/tests/test_stringid.py thirdparty/sqlobject/sqlobject/tests/test_stringid_old.py thirdparty/sqlobject/sqlobject/tests/test_style.py thirdparty/sqlobject/sqlobject/tests/test_style_old.py thirdparty/sqlobject/sqlobject/tests/test_subqueries.py thirdparty/sqlobject/sqlobject/tests/test_transactions.py thirdparty/sqlobject/sqlobject/tests/test_unicode.py thirdparty/sqlobject/sqlobject/tests/test_validation.py thirdparty/sqlobject/sqlobject/util/__init__.py thirdparty/sqlobject/sqlobject/util/backports.py thirdparty/sqlobject/sqlobject/util/moduleloader.py thirdparty/sqlobject/sqlobject/util/threadinglocal.py turbogears/__init__.py turbogears/config.py turbogears/controllers.py turbogears/database.py turbogears/decorator.py turbogears/docgen.py turbogears/errorhandling.py turbogears/finddata.py turbogears/genericfunctions.py turbogears/release.py turbogears/scheduler.py turbogears/startup.py turbogears/testutil.py turbogears/util.py turbogears/validators.py turbogears/command/__init__.py turbogears/command/base.py turbogears/command/i18n.py turbogears/command/info.py turbogears/command/quickstart.py turbogears/feed/__init__.py turbogears/feed/atom0_3.kid turbogears/feed/atom1_0.kid turbogears/feed/feed.py turbogears/feed/rss2_0.kid turbogears/i18n/__init__.py turbogears/i18n/format.py turbogears/i18n/kidutils.py turbogears/i18n/tg_gettext.py turbogears/i18n/utils.py turbogears/i18n/data/__init__.py turbogears/i18n/data/af.py turbogears/i18n/data/af_ZA.py turbogears/i18n/data/am.py turbogears/i18n/data/am_ET.py turbogears/i18n/data/ar.py turbogears/i18n/data/ar_AE.py turbogears/i18n/data/ar_BH.py turbogears/i18n/data/ar_DZ.py turbogears/i18n/data/ar_EG.py turbogears/i18n/data/ar_IN.py turbogears/i18n/data/ar_IQ.py turbogears/i18n/data/ar_JO.py turbogears/i18n/data/ar_KW.py turbogears/i18n/data/ar_LB.py turbogears/i18n/data/ar_LY.py turbogears/i18n/data/ar_MA.py turbogears/i18n/data/ar_OM.py turbogears/i18n/data/ar_QA.py turbogears/i18n/data/ar_SA.py turbogears/i18n/data/ar_SD.py turbogears/i18n/data/ar_SY.py turbogears/i18n/data/ar_TN.py turbogears/i18n/data/ar_YE.py turbogears/i18n/data/be.py turbogears/i18n/data/be_BY.py turbogears/i18n/data/bg.py turbogears/i18n/data/bg_BG.py turbogears/i18n/data/bn.py turbogears/i18n/data/bn_IN.py turbogears/i18n/data/ca.py turbogears/i18n/data/ca_ES.py turbogears/i18n/data/cs.py turbogears/i18n/data/cs_CZ.py turbogears/i18n/data/da.py turbogears/i18n/data/da_DK.py turbogears/i18n/data/de.py turbogears/i18n/data/de_AT.py turbogears/i18n/data/de_BE.py turbogears/i18n/data/de_CH.py turbogears/i18n/data/de_DE.py turbogears/i18n/data/de_LU.py turbogears/i18n/data/el.py turbogears/i18n/data/el_GR.py turbogears/i18n/data/en.py turbogears/i18n/data/en_AU.py turbogears/i18n/data/en_BE.py turbogears/i18n/data/en_BW.py turbogears/i18n/data/en_CA.py turbogears/i18n/data/en_GB.py turbogears/i18n/data/en_HK.py turbogears/i18n/data/en_IE.py turbogears/i18n/data/en_IN.py turbogears/i18n/data/en_MT.py turbogears/i18n/data/en_NZ.py turbogears/i18n/data/en_PH.py turbogears/i18n/data/en_SG.py turbogears/i18n/data/en_US.py turbogears/i18n/data/en_US_POSIX.py turbogears/i18n/data/en_VI.py turbogears/i18n/data/en_ZA.py turbogears/i18n/data/en_ZW.py turbogears/i18n/data/eo.py turbogears/i18n/data/es.py turbogears/i18n/data/es_AR.py turbogears/i18n/data/es_BO.py turbogears/i18n/data/es_CL.py turbogears/i18n/data/es_CO.py turbogears/i18n/data/es_CR.py turbogears/i18n/data/es_DO.py turbogears/i18n/data/es_EC.py turbogears/i18n/data/es_ES.py turbogears/i18n/data/es_GT.py turbogears/i18n/data/es_HN.py turbogears/i18n/data/es_MX.py turbogears/i18n/data/es_NI.py turbogears/i18n/data/es_PA.py turbogears/i18n/data/es_PE.py turbogears/i18n/data/es_PR.py turbogears/i18n/data/es_PY.py turbogears/i18n/data/es_SV.py turbogears/i18n/data/es_US.py turbogears/i18n/data/es_UY.py turbogears/i18n/data/es_VE.py turbogears/i18n/data/et.py turbogears/i18n/data/et_EE.py turbogears/i18n/data/eu.py turbogears/i18n/data/eu_ES.py turbogears/i18n/data/fa.py turbogears/i18n/data/fa_AF.py turbogears/i18n/data/fa_IR.py turbogears/i18n/data/fi.py turbogears/i18n/data/fi_FI.py turbogears/i18n/data/fo.py turbogears/i18n/data/fo_FO.py turbogears/i18n/data/fr.py turbogears/i18n/data/fr_BE.py turbogears/i18n/data/fr_CA.py turbogears/i18n/data/fr_CH.py turbogears/i18n/data/fr_FR.py turbogears/i18n/data/fr_LU.py turbogears/i18n/data/ga.py turbogears/i18n/data/ga_IE.py turbogears/i18n/data/gl.py turbogears/i18n/data/gl_ES.py turbogears/i18n/data/gu.py turbogears/i18n/data/gu_IN.py turbogears/i18n/data/gv.py turbogears/i18n/data/gv_GB.py turbogears/i18n/data/he.py turbogears/i18n/data/he_IL.py turbogears/i18n/data/hi.py turbogears/i18n/data/hi_IN.py turbogears/i18n/data/hr.py turbogears/i18n/data/hr_HR.py turbogears/i18n/data/hu.py turbogears/i18n/data/hu_HU.py turbogears/i18n/data/hy.py turbogears/i18n/data/hy_AM.py turbogears/i18n/data/hy_AM_REVISED.py turbogears/i18n/data/id.py turbogears/i18n/data/id_ID.py turbogears/i18n/data/is.py turbogears/i18n/data/is_IS.py turbogears/i18n/data/it.py turbogears/i18n/data/it_CH.py turbogears/i18n/data/it_IT.py turbogears/i18n/data/ja.py turbogears/i18n/data/ja_JP.py turbogears/i18n/data/kk.py turbogears/i18n/data/kk_KZ.py turbogears/i18n/data/kl.py turbogears/i18n/data/kl_GL.py turbogears/i18n/data/kn.py turbogears/i18n/data/kn_IN.py turbogears/i18n/data/ko.py turbogears/i18n/data/ko_KR.py turbogears/i18n/data/kok.py turbogears/i18n/data/kok_IN.py turbogears/i18n/data/kw.py turbogears/i18n/data/kw_GB.py turbogears/i18n/data/lt.py turbogears/i18n/data/lt_LT.py turbogears/i18n/data/lv.py turbogears/i18n/data/lv_LV.py turbogears/i18n/data/mk.py turbogears/i18n/data/mk_MK.py turbogears/i18n/data/mr.py turbogears/i18n/data/mr_IN.py turbogears/i18n/data/ms.py turbogears/i18n/data/ms_BN.py turbogears/i18n/data/ms_MY.py turbogears/i18n/data/mt.py turbogears/i18n/data/mt_MT.py turbogears/i18n/data/nb.py turbogears/i18n/data/nb_NO.py turbogears/i18n/data/nl.py turbogears/i18n/data/nl_BE.py turbogears/i18n/data/nl_NL.py turbogears/i18n/data/nn.py turbogears/i18n/data/nn_NO.py turbogears/i18n/data/no.py turbogears/i18n/data/no_NO.py turbogears/i18n/data/om.py turbogears/i18n/data/om_ET.py turbogears/i18n/data/om_KE.py turbogears/i18n/data/pa.py turbogears/i18n/data/pa_IN.py turbogears/i18n/data/pl.py turbogears/i18n/data/pl_PL.py turbogears/i18n/data/ps.py turbogears/i18n/data/ps_AF.py turbogears/i18n/data/pt.py turbogears/i18n/data/pt_BR.py turbogears/i18n/data/pt_PT.py turbogears/i18n/data/ro.py turbogears/i18n/data/ro_RO.py turbogears/i18n/data/ru.py turbogears/i18n/data/ru_RU.py turbogears/i18n/data/ru_UA.py turbogears/i18n/data/sh.py turbogears/i18n/data/sh_YU.py turbogears/i18n/data/sk.py turbogears/i18n/data/sk_SK.py turbogears/i18n/data/sl.py turbogears/i18n/data/sl_SI.py turbogears/i18n/data/so.py turbogears/i18n/data/so_DJ.py turbogears/i18n/data/so_ET.py turbogears/i18n/data/so_KE.py turbogears/i18n/data/so_SO.py turbogears/i18n/data/sq.py turbogears/i18n/data/sq_AL.py turbogears/i18n/data/sr.py turbogears/i18n/data/sr_YU.py turbogears/i18n/data/sv.py turbogears/i18n/data/sv_FI.py turbogears/i18n/data/sv_SE.py turbogears/i18n/data/sw.py turbogears/i18n/data/sw_KE.py turbogears/i18n/data/sw_TZ.py turbogears/i18n/data/ta.py turbogears/i18n/data/ta_IN.py turbogears/i18n/data/te.py turbogears/i18n/data/te_IN.py turbogears/i18n/data/th.py turbogears/i18n/data/th_TH.py turbogears/i18n/data/ti.py turbogears/i18n/data/ti_ER.py turbogears/i18n/data/ti_ET.py turbogears/i18n/data/tr.py turbogears/i18n/data/tr_TR.py turbogears/i18n/data/uk.py turbogears/i18n/data/uk_UA.py turbogears/i18n/data/vi.py turbogears/i18n/data/vi_VN.py turbogears/i18n/data/zh.py turbogears/i18n/data/zh_CN.py turbogears/i18n/data/zh_HK.py turbogears/i18n/data/zh_MO.py turbogears/i18n/data/zh_SG.py turbogears/i18n/data/zh_TW.py turbogears/i18n/sogettext/__init__.py turbogears/i18n/sogettext/model.py turbogears/identity/__init__.py turbogears/identity/conditions.py turbogears/identity/exceptions.py turbogears/identity/saprovider.py turbogears/identity/soprovider.py turbogears/identity/visitor.py turbogears/identity/tests/__init__.py turbogears/identity/tests/test_identity.py turbogears/identity/tests/test_visit.py turbogears/qstemplates/__init__.py turbogears/qstemplates/qsbase/+einame+.egg-info/PKG-INFO turbogears/qstemplates/qsbase/+einame+.egg-info/paster_plugins.txt turbogears/qstemplates/qsbase/+einame+.egg-info/sqlobject.txt_tmpl turbogears/qstemplates/qsbase/+package+/__init__.py_tmpl turbogears/qstemplates/qsbase/+package+/release.py_tmpl turbogears/qstemplates/qsbase/+package+/static/css/empty turbogears/qstemplates/qsbase/+package+/static/images/favicon.ico turbogears/qstemplates/qsbase/+package+/static/images/tg_under_the_hood.png turbogears/qstemplates/qsbase/+package+/static/javascript/empty turbogears/qstemplates/qsbase/+package+/templates/__init__.py_tmpl turbogears/qstemplates/quickstart/README.txt_tmpl turbogears/qstemplates/quickstart/dev.cfg_tmpl turbogears/qstemplates/quickstart/sample-prod.cfg_tmpl turbogears/qstemplates/quickstart/setup.py_tmpl turbogears/qstemplates/quickstart/start-+package+.py_tmpl turbogears/qstemplates/quickstart/+package+/controllers.py_tmpl turbogears/qstemplates/quickstart/+package+/json.py_tmpl turbogears/qstemplates/quickstart/+package+/model.py_tmpl turbogears/qstemplates/quickstart/+package+/config/__init__.py_tmpl turbogears/qstemplates/quickstart/+package+/config/app.cfg_tmpl turbogears/qstemplates/quickstart/+package+/config/log.cfg_tmpl turbogears/qstemplates/quickstart/+package+/sqlobject-history/empty turbogears/qstemplates/quickstart/+package+/templates/login.kid turbogears/qstemplates/quickstart/+package+/templates/master.kid turbogears/qstemplates/quickstart/+package+/templates/welcome.kid turbogears/qstemplates/quickstart/+package+/tests/__init__.py_tmpl turbogears/qstemplates/quickstart/+package+/tests/test_controllers.py_tmpl turbogears/qstemplates/quickstart/+package+/tests/test_model.py_tmpl turbogears/qstemplates/quickstartbig/+package+/controllers/__init__.py_tmpl turbogears/qstemplates/quickstartbig/+package+/controllers/root.py_tmpl turbogears/qstemplates/widget/README.txt_tmpl turbogears/qstemplates/widget/setup.py_tmpl turbogears/qstemplates/widget/+package+/widgets.py_tmpl turbogears/static/__init__.py turbogears/static/css/__init__.py turbogears/static/css/interpreter.css turbogears/static/css/toolbox.css turbogears/static/css/widget.css turbogears/static/images/__init__.py turbogears/static/images/add.png turbogears/static/images/admi18n.png turbogears/static/images/arrow_down.png turbogears/static/images/arrow_down_small.png turbogears/static/images/arrow_left.png turbogears/static/images/arrow_right.png turbogears/static/images/arrow_up.png turbogears/static/images/arrow_up_small.png turbogears/static/images/catwalk.png turbogears/static/images/catwalk_logo.png turbogears/static/images/catwalk_logo_bg.png turbogears/static/images/column_chooser.png turbogears/static/images/designer.png turbogears/static/images/discard.png turbogears/static/images/edit.png turbogears/static/images/file.png turbogears/static/images/folder.png turbogears/static/images/identity.png turbogears/static/images/info.png turbogears/static/images/play.png turbogears/static/images/remove.png turbogears/static/images/save.png turbogears/static/images/shell.png turbogears/static/images/small_gear.png turbogears/static/images/stop.png turbogears/static/images/table.gif turbogears/static/images/tg_power.png turbogears/static/images/tg_under_the_hood.png turbogears/static/images/tg_under_the_hood_sans_gear.png turbogears/static/images/toolbox_logo.png turbogears/static/images/toolbox_top_baggrund.png turbogears/static/images/toolbox_top_vertical_line.png turbogears/static/images/top.png turbogears/static/images/top_bg.png turbogears/static/images/transp.png turbogears/static/images/trash.png turbogears/static/images/widgets.png turbogears/static/js/MochiKit.js turbogears/static/js/__init__.py turbogears/static/js/interpreter.js turbogears/static/js/widget.js turbogears/static/js/tool-man/cookies.js turbogears/static/js/tool-man/coordinates.js turbogears/static/js/tool-man/core.js turbogears/static/js/tool-man/css.js turbogears/static/js/tool-man/drag.js turbogears/static/js/tool-man/dragsort.js turbogears/static/js/tool-man/events.js turbogears/tests/__init__.py turbogears/tests/config.cfg turbogears/tests/configfile.cfg turbogears/tests/form.kid turbogears/tests/othertemplate.kid turbogears/tests/simple.kid turbogears/tests/test_catwalk.py turbogears/tests/test_command_i18n.py turbogears/tests/test_config.py turbogears/tests/test_controllers.py turbogears/tests/test_database.py turbogears/tests/test_decorator.py turbogears/tests/test_errorhandling.py turbogears/tests/test_form_controllers.py turbogears/tests/test_genericfunctions.py turbogears/tests/test_i18n.py turbogears/tests/test_validators.py turbogears/tests/test_view.py turbogears/tests/util.py turbogears/tests/catwalk_models/__init__.py turbogears/tests/catwalk_models/browse.py turbogears/tests/catwalk_models/model_list.py turbogears/tests/catwalk_models/model_structure.py turbogears/tests/catwalk_models/single_join.py turbogears/tests/catwalk_models/catwalk-session/session.pkl turbogears/tests/locale/en/LC_MESSAGES/messages.mo turbogears/tests/locale/en/LC_MESSAGES/messages.po turbogears/tests/locale/fi/LC_MESSAGES/messages.mo turbogears/tests/locale/fi/LC_MESSAGES/messages.po turbogears/toolbox/__init__.py turbogears/toolbox/base.py turbogears/toolbox/console.kid turbogears/toolbox/info.kid turbogears/toolbox/main.kid turbogears/toolbox/master.kid turbogears/toolbox/shell.py turbogears/toolbox/widgets.kid turbogears/toolbox/admi18n/__init__.py turbogears/toolbox/admi18n/catalog.py turbogears/toolbox/admi18n/inter.kid turbogears/toolbox/admi18n/internationalization.kid turbogears/toolbox/admi18n/language.kid turbogears/toolbox/admi18n/languageManagement.kid turbogears/toolbox/admi18n/msgfmt.py turbogears/toolbox/admi18n/po_view.kid turbogears/toolbox/admi18n/pygettext.py turbogears/toolbox/admi18n/stringCollection.kid turbogears/toolbox/catwalk/__init__.py turbogears/toolbox/catwalk/browse.py turbogears/toolbox/catwalk/browse_grid.kid turbogears/toolbox/catwalk/catwalk.kid turbogears/toolbox/catwalk/columns.kid turbogears/toolbox/catwalk/static/css/catwalk.css turbogears/toolbox/catwalk/static/javascript/browse.js turbogears/toolbox/catwalk/static/javascript/catwalk.js turbogears/toolbox/catwalk/static/javascript/greybox/AmiJS.js turbogears/toolbox/catwalk/static/javascript/greybox/blank.gif turbogears/toolbox/catwalk/static/javascript/greybox/close.gif turbogears/toolbox/catwalk/static/javascript/greybox/greybox.css turbogears/toolbox/catwalk/static/javascript/greybox/greybox.js turbogears/toolbox/catwalk/static/javascript/greybox/greybox__.js turbogears/toolbox/catwalk/static/javascript/greybox/greybox_inline.js turbogears/toolbox/catwalk/static/javascript/greybox/logo.png turbogears/toolbox/catwalk/static/javascript/greybox/overlay.png turbogears/toolbox/designer/__init__.py turbogears/toolbox/designer/modelDesigner.kid turbogears/toolbox/designer/static/css/style.css turbogears/toolbox/designer/static/diagram/index.html turbogears/toolbox/designer/static/diagram/images/back.gif turbogears/toolbox/designer/static/diagram/images/shadow.png turbogears/toolbox/designer/static/diagram/images/shadow_bottom.png turbogears/toolbox/designer/static/diagram/images/shadow_corner.png turbogears/toolbox/designer/static/diagram/images/shadow_right.png turbogears/toolbox/designer/static/diagram/js/ajax.js turbogears/toolbox/designer/static/diagram/js/animator.js turbogears/toolbox/designer/static/diagram/js/generic.js turbogears/toolbox/designer/static/diagram/js/io.js turbogears/toolbox/designer/static/diagram/js/main.js turbogears/toolbox/designer/static/diagram/js/objects.js turbogears/toolbox/designer/static/diagram/js/settings.js turbogears/toolbox/designer/static/diagram/js/sql_types.js turbogears/toolbox/designer/static/diagram/styles/bar.css turbogears/toolbox/designer/static/diagram/styles/foo turbogears/toolbox/designer/static/diagram/styles/style.css turbogears/toolbox/designer/static/diagram/styles/style.js turbogears/toolbox/designer/static/images/info.png turbogears/toolbox/designer/static/javascript/modelDesigner.js turbogears/toolbox/designer/static/sessions/Survey.js turbogears/toolbox/designer/static/sessions/TurboTunes.js turbogears/toolbox/designer/static/sessions/WebShop.js turbogears/toolbox/designer/static/sh/SyntaxHighlighter.css turbogears/toolbox/designer/static/sh/shBrushCSharp.js turbogears/toolbox/designer/static/sh/shBrushDelphi.js turbogears/toolbox/designer/static/sh/shBrushJScript.js turbogears/toolbox/designer/static/sh/shBrushPhp.js turbogears/toolbox/designer/static/sh/shBrushPython.js turbogears/toolbox/designer/static/sh/shBrushSql.js turbogears/toolbox/designer/static/sh/shBrushVb.js turbogears/toolbox/designer/static/sh/shBrushXml.js turbogears/toolbox/designer/static/sh/shCore.js turbogears/view/__init__.py turbogears/view/base.py turbogears/view/templates/__init__.py turbogears/view/templates/sitetemplate.kid turbogears/visit/__init__.py turbogears/visit/api.py turbogears/visit/savisit.py turbogears/visit/sovisit.py turbogears/widgets/__init__.py turbogears/widgets/base.py turbogears/widgets/big_widgets.py turbogears/widgets/datagrid.py turbogears/widgets/forms.py turbogears/widgets/i18n.py turbogears/widgets/meta.py turbogears/widgets/rpc.py turbogears/widgets/static/ajax.js turbogears/widgets/static/ajaxgrid.js turbogears/widgets/static/autocompletefield.css turbogears/widgets/static/autocompletefield.js turbogears/widgets/static/grid.css turbogears/widgets/static/img.gif turbogears/widgets/static/spinner.gif turbogears/widgets/static/spinnerstopped.png turbogears/widgets/static/calendar/calendar-blue.css turbogears/widgets/static/calendar/calendar-blue2.css turbogears/widgets/static/calendar/calendar-brown.css turbogears/widgets/static/calendar/calendar-green.css turbogears/widgets/static/calendar/calendar-setup.js turbogears/widgets/static/calendar/calendar-system.css turbogears/widgets/static/calendar/calendar-tas.css turbogears/widgets/static/calendar/calendar-win2k-1.css turbogears/widgets/static/calendar/calendar-win2k-2.css turbogears/widgets/static/calendar/calendar-win2k-cold-1.css turbogears/widgets/static/calendar/calendar-win2k-cold-2.css turbogears/widgets/static/calendar/calendar.js turbogears/widgets/static/calendar/menuarrow.gif turbogears/widgets/static/calendar/menuarrow2.gif turbogears/widgets/static/calendar/lang/calendar-af.js turbogears/widgets/static/calendar/lang/calendar-al.js turbogears/widgets/static/calendar/lang/calendar-bg.js turbogears/widgets/static/calendar/lang/calendar-big5-utf-8.js turbogears/widgets/static/calendar/lang/calendar-big5-utf8.js turbogears/widgets/static/calendar/lang/calendar-big5.js turbogears/widgets/static/calendar/lang/calendar-br.js turbogears/widgets/static/calendar/lang/calendar-ca.js turbogears/widgets/static/calendar/lang/calendar-cs-utf-8.js turbogears/widgets/static/calendar/lang/calendar-cs-utf8.js turbogears/widgets/static/calendar/lang/calendar-cs-win.js turbogears/widgets/static/calendar/lang/calendar-da.js turbogears/widgets/static/calendar/lang/calendar-de.js turbogears/widgets/static/calendar/lang/calendar-du.js turbogears/widgets/static/calendar/lang/calendar-el.js turbogears/widgets/static/calendar/lang/calendar-en.js turbogears/widgets/static/calendar/lang/calendar-es.js turbogears/widgets/static/calendar/lang/calendar-fi.js turbogears/widgets/static/calendar/lang/calendar-fr.js turbogears/widgets/static/calendar/lang/calendar-he-utf-8.js turbogears/widgets/static/calendar/lang/calendar-he-utf8.js turbogears/widgets/static/calendar/lang/calendar-hr-utf-8.js turbogears/widgets/static/calendar/lang/calendar-hr-utf8.js turbogears/widgets/static/calendar/lang/calendar-hr.js turbogears/widgets/static/calendar/lang/calendar-hu.js turbogears/widgets/static/calendar/lang/calendar-it.js turbogears/widgets/static/calendar/lang/calendar-jp.js turbogears/widgets/static/calendar/lang/calendar-ko-utf-8.js turbogears/widgets/static/calendar/lang/calendar-ko-utf8.js turbogears/widgets/static/calendar/lang/calendar-ko.js turbogears/widgets/static/calendar/lang/calendar-lt-utf-8.js turbogears/widgets/static/calendar/lang/calendar-lt-utf8.js turbogears/widgets/static/calendar/lang/calendar-lt.js turbogears/widgets/static/calendar/lang/calendar-lv.js turbogears/widgets/static/calendar/lang/calendar-nl.js turbogears/widgets/static/calendar/lang/calendar-no.js turbogears/widgets/static/calendar/lang/calendar-pl-utf-8.js turbogears/widgets/static/calendar/lang/calendar-pl-utf8.js turbogears/widgets/static/calendar/lang/calendar-pl.js turbogears/widgets/static/calendar/lang/calendar-pt-utf-8.js turbogears/widgets/static/calendar/lang/calendar-pt-utf8.js turbogears/widgets/static/calendar/lang/calendar-pt.js turbogears/widgets/static/calendar/lang/calendar-ro.js turbogears/widgets/static/calendar/lang/calendar-ru.js turbogears/widgets/static/calendar/lang/calendar-ru_win_.js turbogears/widgets/static/calendar/lang/calendar-si.js turbogears/widgets/static/calendar/lang/calendar-sk.js turbogears/widgets/static/calendar/lang/calendar-sp.js turbogears/widgets/static/calendar/lang/calendar-sv.js turbogears/widgets/static/calendar/lang/calendar-tr.js turbogears/widgets/static/calendar/lang/calendar-zh.js turbogears/widgets/static/calendar/lang/cn_utf8.js turbogears/widgets/static/calendar/skins/aqua/active-bg.gif turbogears/widgets/static/calendar/skins/aqua/dark-bg.gif turbogears/widgets/static/calendar/skins/aqua/hover-bg.gif turbogears/widgets/static/calendar/skins/aqua/menuarrow.gif turbogears/widgets/static/calendar/skins/aqua/normal-bg.gif turbogears/widgets/static/calendar/skins/aqua/rowhover-bg.gif turbogears/widgets/static/calendar/skins/aqua/status-bg.gif turbogears/widgets/static/calendar/skins/aqua/theme.css turbogears/widgets/static/calendar/skins/aqua/title-bg.gif turbogears/widgets/static/calendar/skins/aqua/today-bg.gif turbogears/widgets/templates/__init__.py turbogears/widgets/templates/datagrid.kid turbogears/widgets/tests/__init__.py turbogears/widgets/tests/form.kid turbogears/widgets/tests/test_datagrid.py turbogears/widgets/tests/test_forms.py turbogears/widgets/tests/test_link_inclusion.py turbogears/widgets/tests/test_nested_form_controllers.py turbogears/widgets/tests/test_nested_widgets.py turbogears/widgets/tests/test_new_validation.py turbogears/widgets/tests/test_request_related_features.py turbogears/widgets/tests/test_widgets.py turbogears/widgets/tests/two_forms.kid PK:4trp EGG-INFO/top_level.txtturbogears PK54!turbogears/__init__.py"TurboGears Front-to-Back Web Framework" import pkg_resources from turbogears import config from turbogears.controllers import expose, flash, validate, redirect, \ error_handler, exception_handler, url from turbogears import controllers, view, database, validators, command, \ i18n, widgets, startup from turbogears.release import version as __version__, author as __author__, \ email as __email__, license as __license__, \ copyright as __copyright__ from turbogears.widgets import mochikit from turbogears.config import update_config from turbogears.startup import start_server extensions = pkg_resources.iter_entry_points("turbogears.extensions") for entrypoint in extensions: ext = entrypoint.load() if hasattr(ext, "tgsymbols"): globals().update(ext.tgsymbols()) i18n.install() # adds _ (gettext) to builtins namespace __all__ = ["url", "expose", "redirect", "validate", "flash", "error_handler", "exception_handler", "view", "controllers", "update_config", "database", "command", "validators", "mochikit", "widgets", "config", "start_server"] PK:43turbogears/__init__.pyc; RDc@smdZdkZdklZdklZlZlZlZl Z l Z l Z dkl Z l Z lZlZlZlZlZlZdklZlZlZlZlZdkl Z dk!l"Z"dk#l$Z$ei%d Z&xDe&D]<Z'e'i(Z)e*e)d oe+i,e)i-qqWei.d d d ddddddddddddddgZ/dS(s&TurboGears Front-to-Back Web FrameworkN(sconfig(sexposesflashsvalidatesredirects error_handlersexception_handlersurl(s controllerssviewsdatabases validatorsscommandsi18nswidgetssstartup(sversionsauthorsemailslicenses copyright(smochikit(s update_config(s start_serversturbogears.extensionss tgsymbolssurlsexposesredirectsvalidatesflashs error_handlersexception_handlersviews controllerss update_configsdatabasescommands validatorssmochikitswidgetssconfigs start_server(0s__doc__s pkg_resourcess turbogearssconfigsturbogears.controllerssexposesflashsvalidatesredirects error_handlersexception_handlersurls controllerssviewsdatabases validatorsscommandsi18nswidgetssstartupsturbogears.releasesversions __version__sauthors __author__semails __email__slicenses __license__s copyrights __copyright__sturbogears.widgetssmochikitsturbogears.configs update_configsturbogears.startups start_serversiter_entry_pointss extensionss entrypointsloadsextshasattrsglobalssupdates tgsymbolssinstalls__all__(sexception_handlersstartups __email__s error_handlers validatorssredirects__all__sflashs update_configs entrypointsmochikitswidgetss extensionss __version__sconfigs __license__sexposes __author__si18nsvalidates __copyright__s start_serversdatabasesurls pkg_resourcess controllerssextscommandsview((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/__init__.pys?s   17%     PK54turbogears/config.pyimport sys, os, glob from cherrypy import config from configobj import ConfigObj import pkg_resources import logging __all__ = ["update_config", "get", "update"] try: set except NameError: from sets import Set as set class ConfigError(Exception): pass def _get_formatters(formatters): for key, formatter in formatters.items(): kw = {} fmt = formatter.get("format", None) if fmt: fmt = fmt.replace("*(", "%(") kw["fmt"] = fmt datefmt = formatter.get("datefmt", None) if datefmt: kw["datefmt"] = datefmt formatter = logging.Formatter(**kw) formatters[key] = formatter def _get_handlers(handlers, formatters): for key, handler in handlers.items(): kw = {} cls = handler.get("class", None) if not cls: raise ConfigError("No class specified for logging handler %s" % key) cls = eval(cls, logging.__dict__) args = handler.get("args", tuple()) if args: args = eval(args, logging.__dict__) handler_obj = cls(*args) level = handler.get("level", None) if level: level = eval(level, logging.__dict__) handler_obj.setLevel(level) formatter = handler.get("formatter", None) if formatter: try: formatter = formatters[formatter] except KeyError: raise ConfigError("Handler %s references unknown " "formatter %s" % (key, formatter)) handler_obj.setFormatter(formatter) handlers[key] = handler_obj def _get_loggers(loggers, handlers): for key, logger in loggers.items(): qualname = logger.get("qualname", None) if qualname: log = logging.getLogger(qualname) else: log = logging.getLogger() level = logger.get("level", None) if level: level = eval(level, logging.__dict__) else: level = logging.NOTSET log.setLevel(level) propagate = logger.get("propagate", None) if propagate is not None: log.propagate = propagate cfghandlers = logger.get("handlers", None) if cfghandlers: if isinstance(cfghandlers, basestring): cfghandlers = [cfghandlers] for handler in cfghandlers: try: handler = handlers[handler] except KeyError: raise ConfigError("Logger %s references unknown " "handler %s" % (key, handler)) log.addHandler(handler) def configure_loggers(config): """Configures the Python logging module, using options that are very similar to the ones listed in the Python documentation. This also removes the logging configuration from the configuration dictionary because CherryPy doesn't like it there. Here are some of the Python examples converted to the format used here: [logging] [[loggers]] [[[parser]]] [logger_parser] level="DEBUG" handlers="hand01" propagate=1 qualname="compiler.parser" [[handlers]] [[[hand01]]] class="StreamHandler" level="NOTSET" formatter="form01" args="(sys.stdout,)" [[formatters]] [[[form01]]] format="F1 *(asctime)s *(levelname)s *(message)s" datefmt= One notable format difference is that *() is used in the formatter instead of %() because %() is already used for config file interpolation. """ if not config.has_key("logging"): config["global"]["tg.new_style_logging"] = False return logcfg = config["logging"] formatters = logcfg.get("formatters", {}) _get_formatters(formatters) handlers = logcfg.get("handlers", {}) _get_handlers(handlers, formatters) loggers = logcfg.get("loggers", {}) _get_loggers(loggers, handlers) del config["logging"] config["global"]["tg.new_style_logging"] = True def update_config(configfile = None, modulename = None): """Updates the system configuration either from a ConfigObj (INI-style) config file, a module name specified in dotted notation or both (the module name is assumed to have a ".cfg" extension). If both are specified, the module is called first, followed by the config file. This means that the config file's options override the options in the module file.""" if modulename: mod_globals = dict() lastdot = modulename.rfind(".") firstdot = modulename.find(".") packagename = modulename[:lastdot] top_level_package = modulename[:firstdot] modname = modulename[lastdot+1:] modfile = pkg_resources.resource_filename(packagename, modname + ".cfg") if not os.path.exists(modfile): modfile = pkg_resources.resource_filename(packagename, modname) if os.path.isdir(modfile): configfiles = glob.glob(os.path.join(modfile, "*.cfg")) else: configfiles = [modfile] configdata = ConfigObj(unrepr=True) top_level_dir = pkg_resources.resource_filename( top_level_package, "")[:-1].replace("\\", "/") package_dir = pkg_resources.resource_filename( packagename, "")[:-1].replace("\\", "/") configdata.merge(dict(DEFAULT= dict(top_level_dir=top_level_dir, package_dir=package_dir))) for file in configfiles: configdata2 = ConfigObj(file, unrepr=True) configdata2["DEFAULT"] = configdata["DEFAULT"] configdata.merge(configdata2) if configfile: if modulename: configdata2 = ConfigObj(configfile, unrepr=True) configdata2['DEFAULT'] = configdata['DEFAULT'] configdata.merge(configdata2) else: configdata = ConfigObj(configfile, unrepr=True) configdict = configdata.dict() configure_loggers(configdict) config.update(configdict) def get(key, default_value=None, return_section=False, path = None): """Retrieves a config value""" return config.get(key, default_value, return_section, path) def update(configvalues): """Updates the configuration with the values from the dictionary.""" return config.update(configvalues)PK:4turbogears/config.pyc; RDc@sdkZdkZdkZdklZdklZdkZdkZdddgZ ye Wn e j odk l Z nXdefdYZd Zd Zd Zd Zeed ZeeedZdZdS(N(sconfig(s ConfigObjs update_configsgetsupdate(sSets ConfigErrorcBstZRS(N(s__name__s __module__(((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/config.pys ConfigErrorscCsx|iD]\}}h}|idt}|o |idd}||dUpdates the configuration with the values from the dictionary.N(sconfigsupdates configvalues(s configvalues((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/config.pysupdates(ssyssossglobscherrypysconfigs configobjs ConfigObjs pkg_resourcessloggings__all__ssets NameErrorssetssSets Exceptions ConfigErrors_get_formatterss _get_handlerss _get_loggerssconfigure_loggerssNones update_configsFalsesgetsupdate(s ConfigObjssetsloggings__all__sconfigure_loggerssossglobs _get_loggerss pkg_resourcessupdatessyss update_configs ConfigErrors _get_handlerssgetsconfigs_get_formatters((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/config.pys?s"       1/PK94檁xAxAturbogears/controllers.py"""Classes and methods for TurboGears controllers.""" import logging import re import urllib import types from itertools import izip, ifilterfalse import cherrypy import kid from dispatch import generic, strategy, functions import turbogears.util as tg_util import turbogears from turbogears import view, database, errorhandling from turbogears.decorator import weak_signature_decorator from turbogears.validators import Invalid from turbogears.errorhandling import error_handler, exception_handler log = logging.getLogger("turbogears.controllers") unicodechars = re.compile(r"([^\x00-\x7F])") def _process_output(output, template, format, content_type, mapping, fragment=False): """Produces final output form from the data returned from a controller method. @param tg_format: format of desired output (html or json) @param output: the output returned by the controller @param template: HTML template to use """ if isinstance(output, dict): from turbogears.widgets import js_location css = tg_util.setlike() js = dict(izip(js_location, iter(tg_util.setlike, None))) if turbogears.config.get("tg.mochikit_all", False): output["tg_mochikit"] = turbogears.mochikit for value in output.itervalues(): if hasattr(value, "retrieve_css"): retrieve = getattr(value, "retrieve_css") if callable(retrieve): css.add_all(value.retrieve_css()) if hasattr(value, "retrieve_javascript"): retrieve = getattr(value, "retrieve_javascript") if callable(retrieve): for script in value.retrieve_javascript(): if hasattr(script, "location"): js[script.location].add(script) else: js[js_location.head].add(script) output["tg_css"] = css output.update([("tg_js_%s" % str(l), js[l]) for l in js_location]) output["tg_flash"] = _get_flash() output = view.render(output, template=template, format=format, mapping=mapping, content_type=content_type, fragment=fragment) else: if content_type: cherrypy.response.headers["Content-Type"] = content_type # fix the Safari XMLHttpRequest encoding problem try: contentType = cherrypy.response.headers["Content-Type"] ua = cherrypy.request.headers["User-Agent"] except KeyError: return output if not contentType.startswith("text/"): return output ua = view.UserAgent(ua) if ua.browser == "safari": if isinstance(output, str): output = output.decode("utf8") output = unicodechars.sub( lambda m: "&#x%x;" % ord(m.group(1)), output).encode("ascii") if isinstance(output, unicode): output = output.encode("utf8") return output class BadFormatError(Exception): """Output-format exception.""" def validate(form=None, validators=None, failsafe_schema=errorhandling.FailsafeSchema.none, failsafe_values=None): """Validate input. @param form form to validate input from @param validators individual validators to use for parameters @param failsafe_schema fail-safe schema @param failsafe_values replacements for erroneous inputs """ def entangle(func): recursion_guard = dict(func=func) if callable(form) and not hasattr(form, "validate"): init_form = lambda self: form(self) else: init_form = lambda self: form def validate(func, *args, **kw): if tg_util.call_on_stack("validate", recursion_guard, 4): return func(*args, **kw) form = init_form(args and args[0] or kw["self"]) args, kw = tg_util.to_kw(func, args, kw) errors = {} if form: value = kw.copy() try: kw.update(form.validate(value)) except Invalid, e: errors = e.unpack_errors() cherrypy.request.validation_exception = e cherrypy.request.validated_form = form cherrypy.request.validation_errors = errors if validators: if isinstance(validators, dict): for field, validator in validators.iteritems(): try: kw[field] = validator.to_python( kw.get(field, None)) except Invalid, error: errors[field] = error else: try: value = kw.copy() kw.update(validators.to_python(value)) except Invalid, error: if hasattr(error, "unpack_errors"): error = error.unpack_errors() elif hasattr(error, "error_dict"): error = error.error_dict if isinstance(error, dict): errors.update(error) else: errors = error if errors: kw = errorhandling.dispatch_failsafe(failsafe_schema, failsafe_values, errors, func, kw) if form: cherrypy.request.input_values = kw.copy() args, kw = tg_util.from_kw(func, args, kw) return errorhandling.run_with_errors(errors, func, *args, **kw) return validate return weak_signature_decorator(entangle) class CustomDispatch(functions.GenericFunction): def combine(self,cases): strict = [strategy.ordered_signatures,strategy.safe_methods] cases = strategy.separate_qualifiers( cases, primary = strict, ) primary = strategy.method_chain(cases.get('primary',[])) if type(primary) == types.InstanceType: for i in primary: for y in i: return y[1] return primary def expose(html=None, validators=None, allow_json=None, template=None, format=None, content_type=None, inputform=None, fragment=False, as_format="default", mapping=None, accept_format=None): """TurboGears verson of CherryPy's expose. In addition to exposing the method to the web, this expose function will also perform validation of input arguments, process output through a template, fix Safari's problem with XMLHttpRequest encodings and provide JSON output on request. @param html: deprecaded in favor for template @type html: string @param template: reference along the Python path for the template and the template engine. @type template: string @param validators: deprecated. Maps argument names to validator applied to that arg @type validators: dict or instance of formencode.Schema @param format: format to output by default @type format: string @param content_type: sets the content-type http header @type content_type: string @param allow_json: allow the function being exposed as json @type: bool @param inputform: deprecated. A form object that is generating the input to this method @type: turbogears.widgets.forms.Form @param mapping: mapping sent to the template engine @type: dict or function """ if html: template = html if not template: template = format if format == "json" or (format == None and template == None): template = "json" allow_json = True if content_type is None: content_type = turbogears.config.get("tg.content_type", None) def entangle(func): if not getattr(func, "exposed", False): def expose(func, *args, **kw): allow_json_from_config = turbogears.config.get("tg.allow_json", False) accept = cherrypy.request.headers.get('Accept', "").lower() if hasattr(cherrypy.request, "in_transaction"): output = func._expose(func, accept, allow_json, allow_json_from_config, *args, **kw) else: cherrypy.request.in_transaction = True output = database.run_with_transaction(func._expose,func, accept, allow_json, allow_json_from_config,*args, **kw) return output def _expose(func, accept, allow_json, allow_json_from_config, *args, **kw): pass _expose = generic(CustomDispatch)(_expose) func.exposed = True func._expose = _expose else: expose = func rule = 'kw.get("tg_format", "default") == "%s"' % as_format if template == "json" and as_format != "default": rule +=' or kw.get("tg_format", "default") == "json"' if accept_format: rule +=' or (accept == "%s" and kw.get("tg_format", "default") == "default")' % accept_format if allow_json != False: func._expose.when('(allow_json or allow_json_from_config) and kw.get("tg_format", None) == "json" or accept =="text/javascript"')( lambda _func, accept, allow_json, allow_json_from_config,*args, **kw: _execute_func( _func, "json", None, None, None, False, *args, **kw)) func._expose.when(rule)(lambda _func, accept, allow_json, allow_json_from_config,*args,**kw: _execute_func( _func, template, format, content_type, mapping, fragment, *args, **kw)) if inputform or validators: import warnings warnings.warn( "Use a separate decorator validate() rather than passing " "arguments validators and/or inputform to decorator " "expose().", DeprecationWarning, 2) func = validate(form=inputform, validators=validators)(func) return expose return weak_signature_decorator(entangle) def _execute_func(func, template, format, content_type, mapping, fragment, *args, **kw): """Call controller method and process it's output.""" if turbogears.config.get("tg.strict_parameters", False): tg_util.remove_keys(kw, ["tg_random", "tg_format"]) else: args, kw = tg_util.adapt_call(func, args, kw) output = errorhandling.try_call(func, *args, **kw) assert isinstance(output, basestring) or isinstance(output, dict) \ or isinstance(output, types.GeneratorType), \ "Method %s.%s() returned unexpected output. Output should " \ "be of type basestring, dict or generator." % ( args[0].__class__.__name__, func.__name__) if isinstance(output, dict): template = output.pop("tg_template", template) if template and template.startswith("."): template = func.__module__[:func.__module__.rfind('.')]+template return _process_output(output, template, format, content_type, mapping, fragment) def flash(message): """Set a message to be displayed in the browser on next page display.""" if hasattr(message, '__unicode__'): message = unicode(message) if isinstance(message, unicode): message = message.encode('utf-8') cherrypy.response.simple_cookie['tg_flash'] = message cherrypy.response.simple_cookie['tg_flash']['path'] = '/' def _get_flash(): """Retrieve the flash message (if one is set), clearing the message.""" request_cookie = cherrypy.request.simple_cookie response_cookie = cherrypy.response.simple_cookie def clearcookie(): response_cookie["tg_flash"] = "" response_cookie["tg_flash"]['expires'] = 0 response_cookie['tg_flash']['path'] = '/' if response_cookie.has_key("tg_flash"): message = response_cookie["tg_flash"].value response_cookie.pop("tg_flash") if request_cookie.has_key("tg_flash"): # New flash overrided old one sitting in cookie. Clear that old cookie. clearcookie() elif request_cookie.has_key("tg_flash"): message = request_cookie["tg_flash"].value if not response_cookie.has_key("tg_flash"): clearcookie() else: message = None if message: message = unicode(message, 'utf-8') return message class Controller(object): """Base class for a web application's controller. Currently, this provides positional parameters functionality via a standard default method. """ class RootController(Controller): """Base class for the root of a web application. Your web application should have one of these. The root of your application is used to compute URLs used by your app. """ is_app_root = True msglog = logging.getLogger('cherrypy.msg') msglogfunc = {0: msglog.info, 1: msglog.warning, 2: msglog.error} def _cp_log_message(self, msg, context = 'nocontext', severity = 0): log = self.msglogfunc[severity] text = ''.join((context, ': ', msg)) log(text) accesslog = logging.getLogger("turbogears.access") def _cp_log_access(self): tmpl = '%(h)s %(l)s %(u)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"' try: username = cherrypy.request.user_name if not username: username = "-" except AttributeError: username = "-" s = tmpl % {'h': cherrypy.request.remoteHost, 'l': '-', 'u': username, 'r': cherrypy.request.requestLine, 's': cherrypy.response.status.split(" ", 1)[0], 'b': cherrypy.response.headers.get('Content-Length', '') or "-", 'f': cherrypy.request.headers.get('referer', ''), 'a': cherrypy.request.headers.get('user-agent', ''), } self.accesslog.info(s) Root = RootController def url(tgpath, tgparams=None, **kw): """Computes URLs. tgpath can be a list or a string. If the path is absolute (starts with a "/"), the server.webpath and the approot of the application are prepended to the path. In order for the approot to be detected properly, the root object should extend controllers.RootController. Query parameters for the URL can be passed in as a dictionary in the second argument *or* as keyword parameters. """ if not isinstance(tgpath, basestring): tgpath = "/".join(list(tgpath)) if tgpath.startswith("/"): if not hasattr(cherrypy.request, "app_root"): found_root = False trail = cherrypy.request.object_trail top = len(trail) - 1 # compute the app_root by stepping back through the object # trail and collecting up the path elements after the first # root we find # we can eliminate this if we find a way to use # CherryPy's mounting mechanism whenever a new root # is hit. rootlist = [] for i in xrange(len(trail) - 1, -1, -1): path, obj = trail[i] if not found_root and isinstance(obj, RootController): if i == top: break found_root = True if found_root and i > 0: rootlist.insert(0, path) app_root = "/".join(rootlist) if not app_root.startswith("/"): app_root = "/" + app_root if app_root.endswith("/"): app_root = app_root[:-1] cherrypy.request.app_root = app_root tgpath = cherrypy.request.app_root + tgpath if tgparams is not None: tgparams.update(kw) else: tgparams = kw result = turbogears.config.get("server.webpath", "") + tgpath args = [] for key, value in tgparams.iteritems(): if value is None: continue if isinstance(value, unicode): value = value.encode("utf8") args.append("%s=%s" % (key, urllib.quote(str(value)))) if args: result += "?" + "&".join(args) return result def redirect(redirect_path, redirect_params=None, **kw): """Redirect (via cherrypy.HTTPRedirect).""" raise cherrypy.HTTPRedirect( url(tgpath=redirect_path, tgparams=redirect_params, **kw)) __all__ = ["expose", "validate", "redirect", "flash", "Root", "RootController", "Controller", "error_handler", "exception_handler", ] PK:4h?FUFUturbogears/controllers.pyc; |JSDc @sdZdkZdkZdkZdkZdklZlZdkZdk Z dk l Z l Z l Z dkiZdkZdklZlZlZdklZdklZdklZlZeidZeid Ze d Z!d e"fd YZ#e$e$ei%i&e$d Z'de i(fdYZ)e$e$e$e$e$e$e$e de$e$d Z*dZ+dZ,dZ-de.fdYZ/de/fdYZ0e0Z1e$dZ2e$dZ3dddddddd d!g Z4dS("s/Classes and methods for TurboGears controllers.N(sizips ifilterfalse(sgenericsstrategys functions(sviewsdatabases errorhandling(sweak_signature_decorator(sInvalid(s error_handlersexception_handlersturbogears.controllerss([^\x00-\x7F])c Cst|todkl}ti} tt|t tit } t i idtot i|dKssasciiN(:s isinstancesoutputsdictsturbogears.widgetss js_locationstg_utilssetlikescsssizipsitersNonesjss turbogearssconfigsgetsFalsesmochikits itervaluessvalueshasattrsgetattrsretrievescallablesadd_alls retrieve_csssretrieve_javascriptsscriptslocationsaddsheadsupdatesappends_[1]slsstrs _get_flashsviewsrenderstemplatesformatsmappings content_typesfragmentscherrypysresponsesheaderss contentTypesrequestsuasKeyErrors startswiths UserAgentsbrowsersdecodes unicodecharsssubsencodesunicode(soutputstemplatesformats content_typesmappingsfragmentsretrieves js_locationsscriptscsss contentTypesjsslsvalues_[1]sua((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/controllers.pys_process_outputsX  !    $ B   "sBadFormatErrorcBstZdZRS(sOutput-format exception.(s__name__s __module__s__doc__(((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/controllers.pysBadFormatErrorPs cs#d}t|SdS(sValidate input. @param form form to validate input from @param validators individual validators to use for parameters @param failsafe_schema fail-safe schema @param failsafe_values replacements for erroneous inputs csitd|totd odn dd}|SdS(Nsfuncsvalidatecs |S(N(sformsself(sself(sform(sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/controllers.pys`scsS(N(sform(sself(sform(sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/controllers.pysbsc s~tiddo|||Sn|o|dp|d}ti|||\}}h}|of|i }y|i |i |Wn-tj o!}|i}|ti_nX|ti_n|ti_ottofxiD]Q\}}y#|i|i|t||sc st|||S(N( s _execute_funcs_funcstemplatesformats content_typesmappingsfragmentsargsskw(s_funcsaccepts allow_jsonsallow_json_from_configsargsskw(s content_typesformatsmappingsfragmentstemplate(sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/controllers.pyssstUse a separate decorator validate() rather than passing arguments validators and/or inputform to decorator expose().isforms validators(sgetattrsfuncsFalsesexposes_exposesgenericsCustomDispatchsTruesexposeds as_formatsrulestemplates accept_formats allow_jsonswhens inputforms validatorsswarningsswarnsDeprecationWarningsvalidate(sfuncs_exposeswarningssexposesrule( s content_types validatorssformats allow_jsonstemplates as_formatsfragmentsmappings inputforms accept_format(sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/controllers.pysentangles*     (   N( shtmlstemplatesformatsNonesTrues allow_jsons content_types turbogearssconfigsgetsentanglesweak_signature_decorator( shtmls validatorss allow_jsonstemplatesformats content_types inputformsfragments as_formatsmappings accept_formatsentangle(( s validatorss allow_jsonstemplatesformats content_types inputformsfragments as_formatsmappings accept_formatsFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/controllers.pysexposes  '  '*c Os/tiidtoti|ddgnti|||\}}t i |||}t |tp t |tpt |tip!td|dii|ift |to|id|}n|o |ido!|i|iid |}nt||||||SdS( s/Call controller method and process it's output.stg.strict_parameterss tg_randoms tg_formatsbMethod %s.%s() returned unexpected output. Output should be of type basestring, dict or generator.is tg_templates.N(s turbogearssconfigsgetsFalsestg_utils remove_keysskws adapt_callsfuncsargss errorhandlingstry_callsoutputs isinstances basestringsdictstypess GeneratorTypesAssertionErrors __class__s__name__spopstemplates startswiths __module__srfinds_process_outputsformats content_typesmappingsfragment( sfuncstemplatesformats content_typesmappingsfragmentsargsskwsoutput((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/controllers.pys _execute_funcsT!cCskt|dot|}nt|to|id}n|tiidEnds the Transactions in all registered hubs (for this thread)N(s hub_registryshubsend(shub((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/database.pysend_allscOszyNtotiin|||}totiint|SWnt i j o)ttotiinnIt i j o)ttotiinnt nXWdt XdS(N(s sqlalchemys objectstoresclearsfuncsargsskwsretvalscommits commit_allscherrypys HTTPRedirectsInternalRedirects rollback_allsend_all(sfuncsargsskwsretval((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/database.pysrun_with_transactions0 cCsh}|tjo|Snx-|iiiD]}t||||ss' def %s(%s): return caller(func, %s) sfuncscallers__composition__N(s signaturesNonesargnamessvarargsskwargssdefaultss getargspecsfuncs formatargspecs parameterss itertoolsscountslensdefvalsargss__name__sfunc_strsdictscallers exec_dictsnewfuncs__doc__s__dict__scopys __module__shasattrs__composition__sappend( sfuncscallers signaturesargssdefaultss parametersskwargssargnamessnewfuncsdefvalsvarargssfunc_strs exec_dict((sargnamessdefvalsDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pysdecorate s,       cs d}t|dSdS(sRDecorate function with entangler. Use signature as signature or preserve original signature if signature is None. Enables alternative decorator syntax for Python 2.3 as seen in PEAK: [my_decorator(foo)] def baz(): pass Mind, the decorator needs to be a closure for this syntax to work. cst||SdS(N(sdecoratesvs entanglers signature(sframesksvs old_locals(s entanglers signature(sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pyscallback9siN(scallbacksadd_assignment_advisor(s entanglers signaturescallback((s entanglers signaturesDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pys decorator+s csd}t|dSdS(s;Decorate function with entangler and change signature to accept arbitrary additional arguments. Enables alternative decorator syntax for Python 2.3 as seen in PEAK: [my_decorator(foo)] def baz(): pass Mind, the decorator needs to be a closure for this syntax to work. cs t||t|SdS(N(sdecoratesvs entanglersmake_weak_signature(sframesksvs old_locals(s entangler(sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pyscallbackIsiN(scallbacksadd_assignment_advisor(s entanglerscallback((s entanglersDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pysweak_signature_decorator=s  csd}|SdS(sDecorate function with caller.cst|SdS(N(sdecoratesfuncscallers signature(sfunc(scallers signature(sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pysentangleOsN(sentangle(scallers signaturesentangle((scallers signaturesDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pyssimple_decoratorMscsd}|SdS(s`Decorate function with caller and change signature to accept arbitrary additional arguments.cst|t|SdS(N(sdecoratesfuncscallersmake_weak_signature(sfunc(scaller(sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pysentangleVsN(sentangle(scallersentangle((scallersDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pyssimple_weak_signature_decoratorSs cCsZt|\}}}}|tjo d}n|tjo d}n||||fSdS(s:Change signature to accept arbitrary additional arguments.s_decorator__kwargss_decorator__varargsN(s getargspecsfuncsargnamessvarargsskwargssdefaultssNone(sfuncsvarargssargnamessdefaultsskwargs((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pysmake_weak_signatureZs    csdSdS(sCompose decorators.cstd|S(NcCs ||S(N(sgsf(sfsg((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pyses(sreduces decoratorssfunc(sfunc(s decorators(sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pysesN((s decorators((s decoratorssDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pyscomposecscCst|d|gSdS(s0Return composition (decorator wise) of function.s__composition__N(sgetattrsfunc(sfunc((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pysfunc_compositiongscCst|dSdS(s'Return original (undecorated) function.iN(sfunc_compositionsfunc(sfunc((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pys func_originalkscCstt|SdS(sReturn identity of function. Identity is invariant under decorator application (if decorator is created with decorator() or weak_signature_decorator()). N(sids func_originalsfunc(sfunc((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pysfunc_idoscCst|t|jSdS(s!Check if functions are identical.N(sfunc_idsfsg(sfsg((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pysfunc_eqwss decoratorscomposesfunc_idsfunc_eqs func_originalsfunc_compositionsweak_signature_decoratorsdecoratesmake_weak_signaturessimple_decoratorssimple_weak_signature_decorator(s itertoolsscopysinspects getargspecs formatargspecsprotocols.advicesadd_assignment_advisorsNonesdecorates decoratorsweak_signature_decoratorssimple_decoratorssimple_weak_signature_decoratorsmake_weak_signaturescomposesfunc_compositions func_originalsfunc_idsfunc_eqs__all__(sadd_assignment_advisorsweak_signature_decoratorscopys__all__ssimple_decoratorsfunc_compositions formatargspecsmake_weak_signaturessimple_weak_signature_decorators itertoolsscomposesdecoratesfunc_eqs getargspecs func_originals decoratorsfunc_id((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/decorator.pys?s            PK54u++turbogears/docgen.pyimport os import sys import shutil import time from glob import glob from setuptools import Command import pkg_resources pkg_resources.require("Kid >= 0.6.4") import kid import re from distutils import log class GenSite(Command): "setuptools command to generate the TurboGears website" user_options = [ ("srcdirs=", "s", "directories containing the source files (default: docs)"), ("destdir=", "d", "destination output directory (default: dist/site)"), ("encoding=", "e", "encoding for output (default: utf8)"), ("force", "f", "regenerate all files"), ("ignoredirs=", "i", "directories to ignore (default: ['.svn', '.cvs'])"), ("ignorefiles=", "x", "files to ignore (default: ['.*\\.pyc', '.DS_Store'])"), ("nodelete=", "l", "directories to leave alone rather than delete"), ("templates=", "t", "mapping of templates to load (format: name=templatefile,name=templatefile)"), ("copydirs=", "c", "copy files from these directories without template proc. (destdir=srcdir,...)"), ("noprintable", "N", "don't make printable version of tutorials"), ("eggdir=", "g", "which directory has the eggs in it (default: '../thirdparty/eggs')") ] boolean_options=["force"] srcdirs = None destdir = "dist/site" encoding = "utf8" force = False ignoredirs = None ignorefiles = None nodelete = None templates = None copydirs = None eggdir = "../thirdparty/eggs" noprintable = False def initialize_options(self): pass def finalize_options(self): if self.srcdirs is None: self.srcdirs = ["docs"] if self.srcdirs == "": self.srcdirs = [] self.ensure_string_list("srcdirs") self.ensure_string("destdir", "dist/site") self.ensure_string("encoding", "utf8") if self.ignoredirs is None: self.ignoredirs = [".svn", ".cvs"] self.ensure_string_list("ignoredirs") if self.ignorefiles is None: self.ignorefiles = ['.*\\.pyc', '.DS_Store'] if self.nodelete is None: self.nodelete = ["dist/site/preview"] self.ensure_string_list("nodelete") self.ensure_string_list("ignorefiles") regexes = [] for pat in self.ignorefiles: regexes.append(re.compile(pat)) self.ignorepatterns = regexes self.templates, self.templates_order = self._split_mapping(self.templates, True) self.copydirs = self._split_mapping(self.copydirs) def _split_mapping(self, valToSplit, preserve_order=False): mapping = {} order = [] if valToSplit and isinstance(valToSplit, basestring): pairs = re.split(",\s*", valToSplit) for pair in pairs: name, filename = re.split("\s*=\s*", pair) mapping[name] = os.path.abspath(filename) order.append(name) if preserve_order: return mapping, order return mapping def check_if_newer(self, src, dest): srcmtime = os.path.getmtime(src) if os.path.exists(dest): destmtime = os.path.getmtime(dest) else: destmtime = 0 return srcmtime > destmtime def copy_if_newer(self, src, dest): if self.force or self.check_if_newer(src, dest): d = os.path.dirname(dest) if not os.path.exists(d): os.makedirs(d) self.copy_file(src, dest) def render_template(self, src, dest, depth): if not self.force and not self.check_if_newer(src, dest): return if not self.dry_run: log.info("rendering %s" % dest) else: log.info("skipping rendering %s" % dest) return template = kid.load_template(src, cache=False) template.Template.serializer = self.serializer toroot = "../" * depth destfile = dest[len(self.destdir)+1:] updated = time.strftime("%b %d, %Y", time.localtime(os.path.getmtime(src))) output = template.serialize(encoding=self.encoding, root=toroot, updated=updated, destfile=destfile, eggs=self.eggs) output = output.replace("$$", "$") destfile = open(dest, "w") destfile.write(output) destfile.close() def update_site_files(self, srcdir, processTemplates = True, destroot=None): if not destroot: destroot = self.destdir for root, dirs, files in os.walk(srcdir): if root != srcdir: fromroot = root[len(srcdir)+1:] segments = fromroot.split(os.sep) if set(segments).intersection(self.ignoredirs): continue depth = len(segments) else: fromroot = "" depth = 0 destdir = os.path.join(destroot, fromroot) if not os.path.exists(destdir): if not self.dry_run: log.info("creating directory %s" % (destdir)) os.makedirs(destdir) else: log.info("skipping creating directory %s" % (destdir)) for file in files: ignore = False abs = os.path.abspath(file) for pat in self.ignorepatterns: if pat.match(file): ignore = True break if ignore: continue for tempfile in self.templates.values(): if tempfile == abs: ignore = True break if ignore: continue ext = os.path.splitext(file)[1] dest = os.path.join(destdir, file) self.currentfiles.add(dest) if not processTemplates or ext != ".html": self.copy_if_newer(os.path.join(root, file), dest) else: self.render_template(os.path.join(root, file), dest, depth) def delete_excess_files(self): for root, dirs, files in os.walk(self.destdir): leavealone = False for dirname in self.nodelete: if root.startswith(dirname): leavealone = True break if leavealone: continue for file in files: dest = os.path.join(root, file) if dest not in self.currentfiles: if not self.dry_run: log.info("deleting %s" % dest) os.unlink(dest) else: log.info("skipping deleting %s" % dest) def run(self): destdir = self.destdir log.info("generating website to %s" % destdir) if not os.path.exists(destdir): log.info("creating %s" % destdir) os.makedirs(destdir) for name in self.templates_order: filename = self.templates[name] log.info("template %s loaded as %s" % (filename, name)) kid.load_template(filename, name=name) if self.eggdir: if not self.eggdir.endswith("/"): self.eggdir += "/" choplen = len(self.eggdir) self.eggs = [fn[choplen:] for fn in glob(self.eggdir + "*")] self.currentfiles = set() self.serializer = kid.HTMLSerializer(encoding=self.encoding) for d in self.srcdirs: self.update_site_files(d) for dest, src in self.copydirs.items(): if os.path.isdir(src): self.update_site_files(src, processTemplates=False, destroot=os.path.join(self.destdir, dest)) else: destfile = os.path.join(self.destdir, os.path.normpath(dest)) self.copy_if_newer(src, destfile) self.currentfiles.add(destfile) self.printable_tutorial() self.delete_excess_files() def printable_tutorial(self): if self.noprintable: return self._make_printable(os.path.join("docs", "wiki20")) self._make_printable(os.path.join("docs", "tutorials", "wiki20"), 3) def _make_printable(self, tutdir, up_to_root=2): endpath = tutdir tutdir = os.path.join(self.srcdirs[0], tutdir) import cElementTree as elementtree masterdoc = """ TurboGears: 20 Minute Wiki Tutorial """ docs = os.listdir(tutdir) docs.sort() for doc in docs: if not doc.endswith(".html"): continue log.info("combining %s" % doc) tree = elementtree.parse(os.path.join(tutdir, doc)) body = tree.find("{http://www.w3.org/1999/xhtml}body") map(body.remove, body.findall("{http://www.w3.org/1999/xhtml}script")) bodytext = elementtree.tostring(body) bodytext = bodytext.replace("", "") bodytext = bodytext.replace('', "") masterdoc += bodytext masterdoc += """ """ masterdoc = masterdoc.replace("html:", "") template = kid.Template(source=masterdoc, root="../" * up_to_root) template.serializer = self.serializer destend = os.path.join(self.destdir, endpath) if not os.path.exists(destend): os.makedirs(destend) outfn = os.path.join(destend, "printable.html") print "combined output: %s" % outfn outfile = open(outfn, "w") masterdoc = template.serialize(encoding=self.encoding) masterdoc = masterdoc.replace("$${", "${") outfile.write(masterdoc) outfile.close() self.currentfiles.add(outfn) PK:4^4^4turbogears/docgen.pyc; RDc@sdkZdkZdkZdkZdklZdklZdkZeiddk Z dk Z dk l Z defdYZ dS(N(sglob(sCommands Kid >= 0.6.4(slogsGenSitec BsRtZdZdddfdddfddd fd d d fd ddfdddfdddfdddfdddfdddfdd d!fg Zd gZeZd"Zd#Ze Z eZ eZ eZ eZeZd$Ze Zd%Zd&Ze d'Zd(Zd)Zd*Zeed+Zd,Zd-Zd.Zd/d0ZRS(1s5setuptools command to generate the TurboGears websitessrcdirs=sss7directories containing the source files (default: docs)sdestdir=sds1destination output directory (default: dist/site)s encoding=ses#encoding for output (default: utf8)sforcesfsregenerate all filess ignoredirs=sis1directories to ignore (default: ['.svn', '.cvs'])s ignorefiles=sxs3files to ignore (default: ['.*\.pyc', '.DS_Store'])s nodelete=sls-directories to leave alone rather than deletes templates=stsJmapping of templates to load (format: name=templatefile,name=templatefile)s copydirs=scsMcopy files from these directories without template proc. (destdir=srcdir,...)s noprintablesNs)don't make printable version of tutorialsseggdir=sgsBwhich directory has the eggs in it (default: '../thirdparty/eggs')s dist/sitesutf8s../thirdparty/eggscCsdS(N((sself((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pysinitialize_options,scCsj|itjodg|_n|idjo g|_n|id|idd|idd|itjodd g|_n|id |itjod d g|_n|itjod g|_n|id|idg}x'|iD]}|i t i |qW||_ |i|it\|_|_|i|i|_dS(Nsdocssssrcdirssdestdirs dist/sitesencodingsutf8s.svns.cvss ignoredirss.*\.pycs .DS_Storesdist/site/previewsnodeletes ignorefiles(sselfssrcdirssNonesensure_string_lists ensure_strings ignoredirss ignorefilessnodeletesregexesspatsappendsrescompilesignorepatternss_split_mappings templatessTruestemplates_orderscopydirs(sselfspatsregexes((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pysfinalize_options/s.       !c Csh}g}|o t|tobtid|}xM|D]A}tid|\}}t i i |||<|i|q<Wn|o||fSn|SdS(Ns,\s*s\s*=\s*(smappingsorders valToSplits isinstances basestringsressplitspairsspairsnamesfilenamesosspathsabspathsappendspreserve_order( sselfs valToSplitspreserve_ordersnamesmappingsfilenamespairspairssorder((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pys_split_mappingIscCsOtii|}tii|otii|}nd}||jSdS(Ni(sosspathsgetmtimessrcssrcmtimesexistssdests destmtime(sselfssrcsdestssrcmtimes destmtime((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pyscheck_if_newerVs cCsl|ip|i||oKtii|}tii | oti |n|i ||ndS(N( sselfsforcescheck_if_newerssrcsdestsosspathsdirnamesdsexistssmakedirss copy_file(sselfssrcsdestsd((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pys copy_if_newer^s c Cs4|i o|i|| odSn|i otid|ntid|dSti |dt }|i |i _ d|}|t|id}tidtitii|}|id|id|d |d |d |i}|id d }t|d}|i ||i!dS(Ns rendering %ssskipping rendering %sscaches../is %b %d, %Ysencodingsrootsupdatedsdestfileseggss$$s$sw("sselfsforcescheck_if_newerssrcsdestsdry_runslogsinfoskids load_templatesFalsestemplates serializersTemplatesdepthstorootslensdestdirsdestfilestimesstrftimes localtimesosspathsgetmtimesupdateds serializesencodingseggssoutputsreplacesopenswritesclose( sselfssrcsdestsdepthsupdatedsdestfilestemplatesoutputstoroot((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pysrender_templatees"  ' cCsQ| o |i}nx5ti|D]$\}} }||joV|t |d}|i ti }t|i|ioq%nt |}n d}d}tii||}tii| oB|i o"tid|ti|qtid|nx8|D]0}t}tii|} x,|iD]!}|i |o t!}Pq=q=W|oqnx/|i"i#D]} | | jo t!}PqqW|oqntii%|d} tii||} |i(i)| | p | djo#|i+tii||| q|i,tii||| |qWq%WdS(Nisiscreating directory %ssskipping creating directory %ss.html(-sdestrootsselfsdestdirsosswalkssrcdirsrootsdirssfilesslensfromrootssplitssepssegmentsssets intersections ignoredirssdepthspathsjoinsexistssdry_runslogsinfosmakedirssfilesFalsesignoresabspathsabssignorepatternsspatsmatchsTrues templatessvaluesstempfilessplitextsextsdests currentfilessaddsprocessTemplatess copy_if_newersrender_template(sselfssrcdirsprocessTemplatessdestrootsfilessdestdirsfromrootsfilespatstempfilesextsabssdirssdestsrootsignoresdepthssegments((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pysupdate_site_fileszsX        cCsxti|iD]\}}}t}x,|i D]!}|i |o t }Pq2q2W|oqnxu|D]m}tii||}||ijoB|i o"tid|ti|qtid|qlqlWqWdS(Ns deleting %ssskipping deleting %s(sosswalksselfsdestdirsrootsdirssfilessFalses leavealonesnodeletesdirnames startswithsTruesfilespathsjoinsdests currentfilessdry_runslogsinfosunlink(sselfsdirssfilessdests leavealonesfilesdirnamesroot((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pysdelete_excess_filess$   c Cs|i}tid|tii| o"tid|ti|nxH|iD]=} |i | }tid|| ft i |d| qZW|iou|iid o|id7_nt|i}gi}t|idD]} || |q~|_nt|_t id|i|_x|iD]}|i|qHWx|ii D]\}}tii#|o/|i|dt$d tii%|i|qotii%|itii&|}|i(|||ii)|qoW|i*|i+dS( Nsgenerating website to %ss creating %sstemplate %s loaded as %ssnames/s*sencodingsprocessTemplatessdestroot(,sselfsdestdirslogsinfososspathsexistssmakedirsstemplates_ordersnames templatessfilenameskids load_templateseggdirsendswithslenschoplensappends_[1]sglobsfnseggsssets currentfilessHTMLSerializersencodings serializerssrcdirssdsupdate_site_filesscopydirssitemssdestssrcsisdirsFalsesjoinsnormpathsdestfiles copy_if_newersaddsprintable_tutorialsdelete_excess_files( sselfssrcsdestsdestdirsfilenames_[1]sdsdestfileschoplensfnsname((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pysruns<    ?    $ cCsT|iodSn|itiidd|itiidddddS(Nsdocsswiki20s tutorialsi(sselfs noprintables_make_printablesosspathsjoin(sself((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pysprintable_tutorials icCs|} tii|id|}dk} d}ti |}|i x|D]} | id oqQntid| | itii|| }|id}t|i|id| i|} | idd} | id d} || 7}qQW|d 7}|id d}tid |d d|} |i| _tii|i | }tii"| oti#|ntii|d}d|GHt%|d}| i'd|i(}|idd}|i)||i*|i+i,|dS(Nis{ TurboGears: 20 Minute Wiki Tutorial s.htmls combining %ss"{http://www.w3.org/1999/xhtml}bodys${http://www.w3.org/1999/xhtml}scripts ss5s shtml:ssourcesroots../sprintable.htmlscombined output: %sswsencodings$${s${(-stutdirsendpathsosspathsjoinsselfssrcdirss cElementTrees elementtrees masterdocslistdirsdocsssortsdocsendswithslogsinfosparsestreesfindsbodysmapsremovesfindallstostringsbodytextsreplaceskidsTemplates up_to_rootstemplates serializersdestdirsdestendsexistssmakedirssoutfnsopensoutfiles serializesencodingswritescloses currentfilessadd(sselfstutdirs up_to_rootsbodys masterdocsdestendsdocsstreesoutfilesbodytextsendpathstemplatesdocs elementtreesoutfn((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pys_make_printablesB        (s__name__s __module__s__doc__s user_optionssboolean_optionssNonessrcdirssdestdirsencodingsFalsesforces ignoredirss ignorefilessnodeletes templatesscopydirsseggdirs noprintablesinitialize_optionssfinalize_optionss_split_mappingscheck_if_newers copy_if_newersrender_templatesTruesupdate_site_filessdelete_excess_filessrunsprintable_tutorials_make_printable(((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pysGenSite s2       0  $ (sosssyssshutilstimesglobs setuptoolssCommands pkg_resourcessrequireskidsres distutilsslogsGenSite( sGenSiteslogsglobs pkg_resourcesssyssresCommandstimesshutilsosskid((sAbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/docgen.pys?s           PK54+9 turbogears/errorhandling.pyimport sys from itertools import izip, repeat, islice from inspect import getargspec import cherrypy from dispatch import generic, NoApplicableMethods, strategy from turbogears.util import inject_args, adapt_call, call_on_stack, has_arg, \ remove_keys, Enum, combine_contexts from turbogears.decorator import func_eq from turbogears.genericfunctions import MultiorderGenericFunction default = strategy.default def dispatch_error(controller, tg_source, tg_errors, tg_exceptions, *args, **kw): """Dispatch error. Error handler is a function registered via register_handler or if no such decorator was applied, the method triggering the error. """ dispatch_error = generic(MultiorderGenericFunction)(dispatch_error) def _register_implicit_errh(controller, tg_source, tg_errors, tg_exceptions, *args, **kw): """Register implicitly declared error handler and re-dispatch. Any method declaring tg_errors parameter is considered an implicitly declared error handler. """ error_handler(tg_source)(tg_source) return dispatch_error(controller, tg_source, tg_errors, tg_exceptions, *args, **kw) _register_implicit_errh = dispatch_error.when( "(tg_errors and has_arg(tg_source, 'tg_errors'))", order=3)( _register_implicit_errh) def _register_implicit_exch(controller, tg_source, tg_errors, tg_exceptions, *args, **kw): """Register implicitly declared exception handler and re-dispatch. Any method declaring tg_exceptions parameter is considered an implicitly declared exception handler. """ exception_handler(tg_source)(tg_source) return dispatch_error(controller, tg_source, tg_errors, tg_exceptions, *args, **kw) _register_implicit_exch = dispatch_error.when( "(tg_exceptions and has_arg(tg_source, 'tg_exceptions'))", order=3)( _register_implicit_exch) def dispatch_error_adaptor(func): """Construct a signature isomorphic to dispatch_error. The actual handler will receive only arguments explicitly declared. """ def adaptor(controller, tg_source, tg_errors, tg_exceptions, *args, **kw): args, kw = inject_args(func, {"tg_source":tg_source, "tg_errors":tg_errors, "tg_exceptions":tg_exceptions}, args, kw, 1) args, kw = adapt_call(func, args, kw, 1) return func(controller, *args, **kw) return adaptor def try_call(func, self, *args, **kw): """Call function, catch and dispatch any resulting exception.""" try: return func(self, *args, **kw) except Exception, e: if isinstance(e, cherrypy.HTTPRedirect) or \ call_on_stack("dispatch_error", {"tg_source":func, "tg_exception":e}, 4): raise else: exc_type, exc_value, exc_trace = sys.exc_info() remove_keys(kw, ("tg_source", "tg_errors", "tg_exceptions")) try: output = dispatch_error(self, func, None, e, *args, **kw) except NoApplicableMethods: raise exc_type, exc_value, exc_trace else: del exc_trace return output def run_with_errors(errors, func, self, *args, **kw): """Branch execution depending on presence of errors.""" if errors: if hasattr(self, "validation_error"): import warnings warnings.warn( "Use decorator error_handler() on per-method base " "rather than defining a validation_error() method.", DeprecationWarning, 2) return self.validation_error(func.__name__, kw, errors) else: remove_keys(kw, ("tg_source", "tg_errors", "tg_exceptions")) try: return dispatch_error(self, func, errors, None, *args, **kw) except NoApplicableMethods: raise NotImplementedError("Method %s.%s() has no applicable " "error handler." % (self.__class__.__name__, func.__name__)) else: return func(self, *args, **kw) def register_handler(handler=None, rules=None): """Register handler as an error handler for decorated method. If handler is not given, method is considered it's own error handler. rules can be a string containing an arbitrary logical Python expression to be used as dispatch rule allowing multiple error handlers for a single method. register_handler decorator is an invariant. """ def register(func): when = "func_eq(tg_source, func)" if rules: when += " and (%s)" % rules dispatch_error.when(dispatch_error.parse(when, *combine_contexts( depth=[0, 1])), order=1)(dispatch_error_adaptor(handler or func)) return func return register def bind_rules(pre_rules): """Prepend rules to error handler specialisation.""" def registrant(handler=None, rules=None): when = pre_rules if rules: when += " and (%s)" % rules return register_handler(handler, when) return registrant error_handler = bind_rules("tg_errors") exception_handler = bind_rules("tg_exceptions") FailsafeSchema = Enum("none", "values", "map_errors", "defaults") def dispatch_failsafe(schema, values, errors, source, kw): """Dispatch fail-safe mechanism for failed inputs.""" dispatch_failsafe = generic()(dispatch_failsafe) def _failsafe_none(schema, values, errors, source, kw): """No fail-safe values.""" return kw _failsafe_none = dispatch_failsafe.when(strategy.default)(_failsafe_none) def _failsafe_values_dict(schema, values, errors, source, kw): """Map errorneus inputs to values.""" kw.update([(key, values[key]) for key in errors.iterkeys() if key in values]) return kw _failsafe_values_dict = dispatch_failsafe.when( "schema is FailsafeSchema.values and isinstance(values, dict) and " "isinstance(errors, dict)")(_failsafe_values_dict) def _failsafe_values_atom(schema, values, errors, source, kw): """Map all errorneus inputs to a single value.""" kw.update(izip(errors.iterkeys(), repeat(values))) return kw _failsafe_values_atom = dispatch_failsafe.when( "schema is FailsafeSchema.values and isinstance(errors, dict)")( _failsafe_values_atom) def _failsafe_map_errors(schema, values, errors, source, kw): """Map errorneus inputs to coresponding exceptions.""" kw.update(errors) return kw _failsafe_map_errors = dispatch_failsafe.when( "schema is FailsafeSchema.map_errors and isinstance(errors, dict)")( _failsafe_map_errors) def _failsafe_defaults(schema, values, errors, source, kw): """Map errorneus inputs to method defaults.""" argnames, defaultvals = getargspec(source)[::3] defaults = dict(izip(islice(argnames, len(argnames) - len(defaultvals), None), defaultvals)) kw.update([(key, defaults[key]) for key in errors.iterkeys() if key in defaults]) return kw _failsafe_defaults = dispatch_failsafe.when( "schema is FailsafeSchema.defaults and isinstance(errors, dict)")( _failsafe_defaults) __all__ = ["dispatch_error", "dispatch_error_adaptor", "try_call", "run_with_errors", "default", "register_handler", "FailsafeSchema", "dispatch_failsafe", "error_handler", "exception_handler", ] PK:4Vschema is FailsafeSchema.defaults and isinstance(errors, dict)sdispatch_errorsdispatch_error_adaptorstry_callsrun_with_errorssdefaultsregister_handlersFailsafeSchemasdispatch_failsafes error_handlersexception_handler(-ssyss itertoolssizipsrepeatsislicesinspects getargspecscherrypysdispatchsgenericsNoApplicableMethodssstrategysturbogears.utils inject_argss adapt_calls call_on_stackshas_args remove_keyssEnumscombine_contextssturbogears.decoratorsfunc_eqsturbogears.genericfunctionssMultiorderGenericFunctionsdefaultsdispatch_errors_register_implicit_errhswhens_register_implicit_exchsdispatch_error_adaptorstry_callsrun_with_errorssNonesregister_handlers bind_ruless error_handlersexception_handlersFailsafeSchemasdispatch_failsafes_failsafe_nones_failsafe_values_dicts_failsafe_values_atoms_failsafe_map_errorss_failsafe_defaultss__all__(%s_register_implicit_exchs adapt_callsdispatch_failsafescherrypysdispatch_error_adaptorsizips bind_ruless_register_implicit_errhs error_handlersNoApplicableMethodsscombine_contextss_failsafe_values_dictsFailsafeSchemas__all__sgenericsEnumsstrategysrun_with_errorssregister_handlers getargspecstry_calls_failsafe_defaultssrepeats_failsafe_nones inject_argsssyssdispatch_errorsisliceshas_argsdefaultsexception_handlersfunc_eqs call_on_stacks remove_keyssMultiorderGenericFunctions_failsafe_map_errorss_failsafe_values_atom((sHbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/errorhandling.pys?sF   1                 PK54.@@""turbogears/finddata.py# Note: you may want to copy this into your setup.py file verbatim, as # you can't import this from another package, when you don't know if # that package is installed yet. import os import sys from fnmatch import fnmatchcase from distutils.util import convert_path # Provided as an attribute, so you can append to these instead # of replicating them: standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak') standard_exclude_directories = ('.*', 'CVS', '_darcs', './build', './dist', 'EGG-INFO', '*.egg-info') def find_package_data( where='.', package='', exclude=standard_exclude, exclude_directories=standard_exclude_directories, only_in_packages=True, show_ignored=False): """ Return a dictionary suitable for use in ``package_data`` in a distutils ``setup.py`` file. The dictionary looks like:: {'package': [files]} Where ``files`` is a list of all the files in that package that don't match anything in ``exclude``. If ``only_in_packages`` is true, then top-level directories that are not packages won't be included (but directories under packages will). Directories matching any pattern in ``exclude_directories`` will be ignored; by default directories with leading ``.``, ``CVS``, and ``_darcs`` will be ignored. If ``show_ignored`` is true, then all the files that aren't included in package data are shown on stderr (for debugging purposes). Note patterns use wildcards, or can be exact paths (including leading ``./``), and all searching is case-insensitive. """ out = {} stack = [(convert_path(where), '', package, only_in_packages)] while stack: where, prefix, package, only_in_packages = stack.pop(0) for name in os.listdir(where): fn = os.path.join(where, name) if os.path.isdir(fn): bad_name = False for pattern in exclude_directories: if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()): bad_name = True if show_ignored: print >> sys.stderr, ( "Directory %s ignored by pattern %s" % (fn, pattern)) break if bad_name: continue if os.path.isfile(os.path.join(fn, '__init__.py')): if not package: new_package = name else: new_package = package + '.' + name stack.append((fn, '', new_package, False)) else: stack.append((fn, prefix + name + '/', package, only_in_packages)) elif package or not only_in_packages: # is a file bad_name = False for pattern in exclude: if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()): bad_name = True if show_ignored: print >> sys.stderr, ( "File %s ignored by pattern %s" % (fn, pattern)) break if bad_name: continue out.setdefault(package, []).append(prefix+name) return out if __name__ == '__main__': import pprint pprint.pprint( find_package_data(show_ignored=True)) PK:4\y y turbogears/finddata.pyc; RDc@sdkZdkZdklZdklZdddddfZddd d d d d fZddeeee dZ e djo#dk Z e i e dendS(N(s fnmatchcase(s convert_paths*.pys*.pycs*~s.*s*.baksCVSs_darcss./builds./distsEGG-INFOs *.egg-infos.sc Cs?h} t|d||fg} x| o | id\}} }}xti |D]}ti i ||} ti i| ot}xd|D]\} t|| p| i| ijo-t}|otid| | fIJnPqqW|oqVnti iti i | do=| o |}n|d|}| i| d|tfq.| i| | |d||fqV|p| ot}xd|D]\} t|| p| i| ijo-t}|otid| | fIJnPqqW|oqVn| i|gi| |qVqVWq$W| SdS( sj Return a dictionary suitable for use in ``package_data`` in a distutils ``setup.py`` file. The dictionary looks like:: {'package': [files]} Where ``files`` is a list of all the files in that package that don't match anything in ``exclude``. If ``only_in_packages`` is true, then top-level directories that are not packages won't be included (but directories under packages will). Directories matching any pattern in ``exclude_directories`` will be ignored; by default directories with leading ``.``, ``CVS``, and ``_darcs`` will be ignored. If ``show_ignored`` is true, then all the files that aren't included in package data are shown on stderr (for debugging purposes). Note patterns use wildcards, or can be exact paths (including leading ``./``), and all searching is case-insensitive. sis"Directory %s ignored by pattern %ss __init__.pys.s/sFile %s ignored by pattern %sN(souts convert_pathswherespackagesonly_in_packagessstackspopsprefixsosslistdirsnamespathsjoinsfnsisdirsFalsesbad_namesexclude_directoriesspatterns fnmatchcaseslowersTrues show_ignoredssyssstderrsisfiles new_packagesappendsexcludes setdefault(swherespackagesexcludesexclude_directoriessonly_in_packagess show_ignoredsnames new_packagesbad_namesprefixspatternsstacksfnsout((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/finddata.pysfind_package_datasN) " %) *s__main__s show_ignored( sosssyssfnmatchs fnmatchcasesdistutils.utils convert_pathsstandard_excludesstandard_exclude_directoriessTruesFalsesfind_package_datas__name__spprint(s convert_paths fnmatchcasespprintssyssstandard_exclude_directoriessstandard_excludesfind_package_datasos((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/finddata.pys?s    M  PK54}D turbogears/genericfunctions.pyimport sys from itertools import izip, repeat, chain as ichain from dispatch import strategy, functions class MultiorderGenericFunction(functions.GenericFunction): """Generic function allowing a priori method ordering.""" def __init__(self, func): functions.GenericFunction.__init__(self, func) self.order_when = [] self.order_around = [] def when(self, cond, order=0): if order not in self.order_when: self.order_when.append(order) self.order_when.sort() return self._decorate(cond, "primary%d" % order) def around(self, cond, order=0): if order not in self.order_around: self.order_around.append(order) self.order_around.sort() return self._decorate(cond, "around%d" % order) # Based on dispatch.functions.GenericFunction.combine def combine(self, cases): strict = [strategy.ordered_signatures,strategy.safe_methods] loose = [strategy.ordered_signatures,strategy.all_methods] primary_names = ['primary%d' % order for order in self.order_when] around_names = ['around%d' % order for order in self.order_around] cases = strategy.separate_qualifiers( cases, before = loose, after =loose, **dict(izip(ichain(primary_names, around_names), repeat(strict))) ) primary = strategy.method_chain(ichain( *[cases.get(primary, []) for primary in primary_names])) if cases.get('after') or cases.get('before'): befores = strategy.method_list(cases.get('before',[])) afters = strategy.method_list(list(cases.get('after',[]))[::-1]) def chain(*args,**kw): for tmp in befores(*args,**kw): pass # toss return values result = primary(*args,**kw) for tmp in afters(*args,**kw): pass # toss return values return result else: chain = primary if (self.order_around): chain = strategy.method_chain(ichain(*([cases.get(around, []) for around in around_names] + [[chain]]))) return chain def getter(var): """Create an accessor for given variable.""" frame = sys._getframe(1) return lambda: var in frame.f_locals and frame.f_locals[var] or \ frame.f_globals[var] __all__ = ["MultiorderGenericFunction", "getter", ] PK:4)hturbogears/genericfunctions.pyc; RDc@sgdkZdklZlZlZdklZlZdei fdYZ dZ ddgZ dS(N(sizipsrepeatschain(sstrategys functionssMultiorderGenericFunctioncBs8tZdZdZddZddZdZRS(s3Generic function allowing a priori method ordering.cCs)tii||g|_g|_dS(N(s functionssGenericFunctions__init__sselfsfuncs order_whens order_around(sselfsfunc((sKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/genericfunctions.pys__init__ s icCsI||ijo!|ii||iin|i|d|SdS(Ns primary%d(sordersselfs order_whensappendssorts _decoratescond(sselfscondsorder((sKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/genericfunctions.pyswhenscCsI||ijo!|ii||iin|i|d|SdS(Nsaround%d(sordersselfs order_aroundsappendssorts _decoratescond(sselfscondsorder((sKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/genericfunctions.pysaroundsc stitig}titig}gi}|i D]} |d| q5~} gi}|i D]} |d| qc~}ti|d|d|ttt| |t|}titgi}| D]||igq~|idp |ido_ti|idgtit|idgdddd}n}|i oPtitgi}|D]}||i|gq~|gg}n|SdS(Ns primary%dsaround%dsbeforesaftericsKx||D]}qW||}x||D]}q9W|SdS(N(sbeforessargsskwstmpsprimarysresultsafters(sargsskwstmpsresult(sprimarysafterssbefores(sKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/genericfunctions.pyschain2s(sstrategysordered_signaturess safe_methodssstricts all_methodssloosesappends_[1]sselfs order_whensorders primary_namess order_arounds around_namessseparate_qualifiersscasessdictsizipsichainsrepeats method_chainsprimarysgets method_listsbeforesslistsaftersschainsaround( sselfscasess around_namesschainsloosesprimarysarounds_[1]sstricts primary_namessafterssordersbefores((sprimarysafterssbeforessKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/genericfunctions.pyscombines.. 3B . P(s__name__s __module__s__doc__s__init__swhensaroundscombine(((sKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/genericfunctions.pysMultiorderGenericFunctions    cs tiddSdS(s&Create an accessor for given variable.ics)ijo ip iS(N(svarsframesf_localss f_globals((svarsframe(sKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/genericfunctions.pysEsN(ssyss _getframesframe(svarsframe((svarsframesKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/genericfunctions.pysgetterBssgetter( ssyss itertoolssizipsrepeatschainsichainsdispatchsstrategys functionssGenericFunctionsMultiorderGenericFunctionsgetters__all__( s functionssrepeats__all__sizipsstrategyssyssgettersichainsMultiorderGenericFunction((sKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/genericfunctions.pys?s ; PK64 3turbogears/release.pyversion = "0.9a5" author = "Kevin Dangoor" email = "dangoor+turbogears@gmail.com" copyright = "Copyright 2005 Kevin Dangoor and contributors" license = "MIT" PK:4Pturbogears/release.pyc; RDc@s"dZdZdZdZdZdS(s0.9a5s Kevin Dangoorsdangoor+turbogears@gmail.coms-Copyright 2005 Kevin Dangoor and contributorssMITN(sversionsauthorsemails copyrightslicense(slicensesversionsemails copyrightsauthor((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/release.pys?sPK64g,F,Fturbogears/scheduler.py"""Module that provides a cron-like task scheduler. This task scheduler is designed to be used from inside your own program. You can schedule Python functions to be called at specific intervals or days. It uses the standard 'sched' module for the actual task scheduling, but provides much more: - repeated tasks (at intervals, or on specific days) - error handling (exceptions in tasks don't kill the scheduler) - optional to run scheduler in its own thread or separate process - optional to run a task in its own thread or separate process If the threading module is available, you can use the various Threaded variants of the scheduler and associated tasks. If threading is not available, you could still use the forked variants. If fork is also not available, all processing is done in a single process, sequentially. There are three Scheduler classes: Scheduler ThreadedScheduler ForkedScheduler You usually add new tasks to a scheduler using the add_interval_task or add_daytime_task methods, with the appropriate processmethod argument to select sequential, threaded or forked processing. NOTE: it is impossible to add new tasks to a ForkedScheduler, after the scheduler has been started! For more control you could use one of the following Task classes and use schedule_task or schedule_task_abs: IntervalTask ThreadedIntervalTask ForkedIntervalTask WeekdayTask ThreadedWeekdayTask ForkedWeekdayTask MonthdayTask ThreadedMonthdayTask ForkedMonthdayTask Kronos is the Greek God of Time. This module is based on Kronos by Irmen de Jong, but has been modified to better fit within TurboGears. Additionally, this module appeared to no longer be supported/in development. """ # # $Id: kronos.py,v 1.5 2004/10/06 22:43:49 irmen Exp $ # # (c) Irmen de Jong. # This is open-source software, released under the MIT Software License: # http://www.opensource.org/licenses/mit-license.php # import os, sys import sched, time import traceback import weakref from turbogears.util import Enum method = Enum("sequential", "forked", "threaded") class Scheduler: """The Scheduler itself.""" def __init__(self): self.running=True self.sched = sched.scheduler(time.time, self.__delayfunc) def __delayfunc(self, delay): # This delay function is basically a time.sleep() that is # divided up, so that we can check the self.running flag while delaying. # there is an additional check in here to ensure that the top item of # the queue hasn't changed if delay<10: time.sleep(delay) else: toptime = self.sched.queue[0][0] endtime = time.time() + delay period=5 stoptime = endtime - period while self.running and stoptime > time.time() and \ self.sched.queue[0][0] == toptime: time.sleep(period) if not self.running or self.sched.queue[0][0] != toptime: return now = time.time() if endtime > now: time.sleep(endtime - now) def _acquire_lock(self): pass def _release_lock(self): pass def add_interval_task(self, action, taskname, initialdelay, interval, processmethod, args, kw): """Add a new Interval Task to the schedule. A very short initialdelay or one of zero cannot be honored, you will see a slight delay before the task is first executed. This is because the scheduler needs to pick it up in its loop.""" if initialdelay<0 or interval<1: raise ValueError("delay or interval must be >0") # Select the correct IntervalTask class. Not all types may be available! if processmethod==method.sequential: TaskClass=IntervalTask elif processmethod==method.threaded: TaskClass = ThreadedIntervalTask elif processmethod==method.forked: TaskClass = ForkedIntervalTask else: raise ValueError("invalid processmethod") if not args: args=[] if not kw: kw={} task = TaskClass(taskname, interval, action, args, kw) self.schedule_task(task, initialdelay) return task def add_daytime_task(self, action, taskname, weekdays, monthdays, timeonday, processmethod, args): """Add a new Day Task (Weekday or Monthday) to the schedule.""" if weekdays and monthdays: raise ValueError("you can only specify weekdays or monthdays, not both") if not args: args=[] if not kw: kw={} if weekdays: # Select the correct WeekdayTask class. Not all types may be available! if processmethod==method.sequential: TaskClass=WeekdayTask elif processmethod==method.threaded: TaskClass = ThreadedWeekdayTask elif processmethod==method.forked: TaskClass = ForkedWeekdayTask else: raise ValueError("invalid processmethod") task=TaskClass(taskname, weekdays, timeonday, action, args) if monthdays: # Select the correct MonthdayTask class. Not all types may be available! if processmethod==method.sequential: TaskClass=MonthdayTask elif processmethod==method.threaded: TaskClass = ThreadedMonthdayTask elif processmethod==method.forked: TaskClass = ForkedMonthdayTask else: raise ValueError("invalid processmethod") task=TaskClass(taskname, monthdays, timeonday, action, args, kw) firsttime=task.get_schedule_time(True) self.schedule_task_abs(task, firsttime) return task def schedule_task(self, task, delay): """Low-level method to add a new task to the scheduler with the given delay (seconds).""" if self.running: self._acquire_lock() # lock the sched queue, if needed try: task.event = self.sched.enter(delay, 0, task, (weakref.ref(self),) ) finally: self._release_lock() else: task.event = self.sched.enter(delay, 0, task, (weakref.ref(self),) ) def schedule_task_abs(self, task, abstime): """Low-level method to add a new task to the scheduler for the given absolute time value.""" if self.running: self._acquire_lock() # lock the sched queue, if needed try: task.event = self.sched.enterabs(abstime, 0, task, (weakref.ref(self),) ) finally: self._release_lock() else: task.event = self.sched.enterabs(abstime, 0, task, (weakref.ref(self),) ) def start(self): """Start the scheduler.""" self._run() def stop(self): """Remove all pending tasks and stop the Scheduler.""" self.running=False self.sched.queue[:]=[] def cancel(self, task): self.sched.cancel(task.event) def _run(self): # Low-level run method to do the actual scheduling loop. while self.running: try: self.sched.run() except Exception,x: print >>sys.stderr, "ERROR DURING SCHEDULER EXECUTION",x print >>sys.stderr, "".join(traceback.format_exception(*sys.exc_info())) print >>sys.stderr, "-"*20 # queue is empty; sleep a short while before checking again if self.running: time.sleep(5) class Task: """Abstract base class of all scheduler tasks""" def __init__(self, name, action, args, kw): """This is an abstract class!""" self.name=name self.action=action self.args=args self.kw=kw def __call__(self, schedulerref): """Execute the task action in the scheduler's thread.""" try: self.execute() except Exception,x: self.handle_exception(x) self.reschedule(schedulerref()) def reschedule(self, scheduler): """This is an abstract class, this method is defined in one of the sub classes!""" raise NotImplementedError("you're using the abstract base class 'Task', use a concrete class instead") def execute(self): """Execute the actual task.""" self.action(*self.args, **self.kw) def handle_exception(self, exc): """Handle any exception that occured during task execution.""" print >>sys.stderr, "ERROR DURING TASK EXECUTION",exc print >>sys.stderr,"".join(traceback.format_exception(*sys.exc_info())) print >>sys.stderr,"-"*20 class IntervalTask(Task): """A repeated task that occurs at certain intervals (in seconds).""" def __init__(self, name, interval, action, args=None, kw=None): Task.__init__(self, name, action, args, kw) self.interval=interval def reschedule(self, scheduler): # reschedule this task according to its interval (in seconds). scheduler.schedule_task(self, self.interval) class DayTaskRescheduler: """A mixin class that contains the reschedule logic for the DayTasks.""" def __init__(self, timeonday): self.timeonday=timeonday def get_schedule_time(self, today): """Calculate the time value at which this task is to be scheduled.""" now=list(time.localtime()) if today: # schedule for today. let's see if that is still possible if (now[3], now[4]) >= self.timeonday: now[2]+=1 # too bad, it will be tomorrow else: now[2]+=1 # tomorrow now[3], now[4] = self.timeonday # set new time on day (hour,minute) now[5]=0 # seconds return time.mktime(now) def reschedule(self, scheduler): # Reschedule this task according to the daytime for the task. # The task is scheduled for tomorrow, for the given daytime. # (The execute method in the concrete Task classes will check # if the current day is a day on which the task must run). abstime = self.get_schedule_time(False) scheduler.schedule_task_abs(self, abstime) class WeekdayTask(DayTaskRescheduler, Task): """A task that is called at specific days in a week (1-7), at a fixed time on the day.""" def __init__(self, name, weekdays, timeonday, action, args=None, kw=None): if type(timeonday) not in (list,tuple) or len(timeonday) != 2: raise TypeError("timeonday must be a 2-tuple (hour,minute)") if type(weekdays) not in (list,tuple): raise TypeError("weekdays must be a sequence of weekday numbers 1-7") DayTaskRescheduler.__init__(self, timeonday) Task.__init__(self, name, action, args, kw) self.days=weekdays def execute(self): # This is called every day, at the correct time. We only need to # check if we should run this task today (this day of the week). weekday=time.localtime().tm_wday+1 if weekday in self.days: self.action(*self.args, **self.kw) class MonthdayTask(DayTaskRescheduler, Task): """A task that is called at specific days in a month (1-31), at a fixed time on the day.""" def __init__(self, name, monthdays, timeonday, action, args=None, kw=None): if type(timeonday) not in (list,tuple) or len(timeonday) != 2: raise TypeError("timeonday must be a 2-tuple (hour,minute)") if type(monthdays) not in (list,tuple): raise TypeError("monthdays must be a sequence of monthdays numbers 1-31") DayTaskRescheduler.__init__(self, timeonday) Task.__init__(self, name, action, args, kw) self.days=monthdays def execute(self): # This is called every day, at the correct time. We only need to # check if we should run this task today (this day of the month). if time.localtime().tm_mday in self.days: self.action(*self.args, **self.kw) try: import threading class ThreadedScheduler(Scheduler): """A Scheduler that runs in its own thread.""" def __init__(self): Scheduler.__init__(self) self._lock=threading.Lock() # we require a lock around the task queue def start(self): # Start method that splices of a thread in which the scheduler will run. self.thread=threading.Thread(target=self._run) self.thread.setDaemon(True) self.thread.start() def stop(self): # Stop method that stops the scheduler and waits for the thread to finish. Scheduler.stop(self) try: self.thread.join() except AttributeError: pass def _acquire_lock(self): self._lock.acquire() # lock the thread's task queue def _release_lock(self): self._lock.release() # release the thread's task queue class ThreadedTaskMixin: """A mixin class to make a Task execute in a separate thread.""" def __call__(self, schedulerref): # execute the task action in its own thread. threading.Thread(target=self.threadedcall).start() self.reschedule(schedulerref()) def threadedcall(self): # This method is run within its own thread, so we have to # do the execute() call and exception handling here. try: self.execute() except Exception,x: self.handle_exception(x) class ThreadedIntervalTask(ThreadedTaskMixin, IntervalTask): """Interval Task that executes in its own thread.""" pass class ThreadedWeekdayTask(ThreadedTaskMixin, WeekdayTask): """Weekday Task that executes in its own thread.""" pass class ThreadedMonthdayTask(ThreadedTaskMixin, MonthdayTask): """Monthday Task that executes in its own thread.""" pass except ImportError: # threading is not available pass if hasattr(os,"fork"): import signal class ForkedScheduler(Scheduler): """A Scheduler that runs in its own forked process.""" def __del__(self): if hasattr(self, "childpid"): os.kill(self.childpid, signal.SIGKILL) def start(self): # Start method that forks of a new process in which the scheduler will run. pid = os.fork() if pid==0: # we are the child signal.signal(signal.SIGUSR1, self.signalhandler) self._run() os._exit(0) else: # we are the parent self.childpid=pid del self.sched # can no longer insert in the scheduler queue def stop(self): # Stop method that stops the scheduler and waits for the process to finish. os.kill(self.childpid, signal.SIGUSR1) os.waitpid(self.childpid,0) def signalhandler(self, sig, stack): Scheduler.stop(self) class ForkedTaskMixin: """A mixin class to make a Task execute in a separate process.""" def __call__(self, schedulerref): # execute the task action in its own process. pid=os.fork() if pid==0: # we are the child try: self.execute() except Exception,x: self.handle_exception(x) os._exit(0) else: # we are the parent self.reschedule(schedulerref()) class ForkedIntervalTask(ForkedTaskMixin, IntervalTask): """Interval Task that executes in its own process.""" pass class ForkedWeekdayTask(ForkedTaskMixin, WeekdayTask): """Weekday Task that executes in its own process.""" pass class ForkedMonthdayTask(ForkedTaskMixin, MonthdayTask): """Monthday Task that executes in its own process.""" pass _scheduler_instance = None def _get_scheduler(): global _scheduler_instance si = _scheduler_instance if not si: si = ThreadedScheduler() _scheduler_instance = si return si def _start_scheduler(): si = _get_scheduler() si.start() def _stop_scheduler(): if not _scheduler_instance: return si = _get_scheduler() si.stop() def add_interval_task(action, interval, args=None, kw=None, initialdelay=0, processmethod=method.threaded, taskname=None): si = _get_scheduler() return si.add_interval_task(action=action, interval=interval, args=args, kw=kw, initialdelay=initialdelay, processmethod=processmethod, taskname=taskname) def add_weekday_task(action, weekdays, timeonday, args=None, kw=None, processmethod=method.threaded, taskname=None): si = _get_scheduler() return si.add_daytime_task(action=action, taskname=taskname, weekdays=weekdays, monthdays=None, timeonday=timeonday, processmethod=processmethod, args=args, kw=kw) def add_monthday_task(action, monthdays, timeonday, args=None, kw=None, processmethod=method.threaded, taskname=None): si = _get_scheduler() return si.add_daytime_task(action=action, taskname=taskname, weekdays=None, monthdays=monthdays, timeonday=timeonday, processmethod=processmethod, args=args, kw=kw) def cancel(task): si = _get_scheduler() si.cancel(task) PK:42i2iturbogears/scheduler.pyc; RDc@s}dZdkZdkZdkZdkZdkZdkZdklZedddZ dfdYZ dfd YZ d e fd YZ d fd YZ de e fdYZde e fdYZydkZde fdYZdfdYZdee fdYZdeefdYZdeefdYZWnej onXeedodkZde fdYZdfd YZd!ee fd"YZd#eefd$YZd%eefd&YZnead'Z d(Z!d)Z"eed*e i#ed+Z$eee i#ed,Z%eee i#ed-Z&d.Z'dS(/sModule that provides a cron-like task scheduler. This task scheduler is designed to be used from inside your own program. You can schedule Python functions to be called at specific intervals or days. It uses the standard 'sched' module for the actual task scheduling, but provides much more: - repeated tasks (at intervals, or on specific days) - error handling (exceptions in tasks don't kill the scheduler) - optional to run scheduler in its own thread or separate process - optional to run a task in its own thread or separate process If the threading module is available, you can use the various Threaded variants of the scheduler and associated tasks. If threading is not available, you could still use the forked variants. If fork is also not available, all processing is done in a single process, sequentially. There are three Scheduler classes: Scheduler ThreadedScheduler ForkedScheduler You usually add new tasks to a scheduler using the add_interval_task or add_daytime_task methods, with the appropriate processmethod argument to select sequential, threaded or forked processing. NOTE: it is impossible to add new tasks to a ForkedScheduler, after the scheduler has been started! For more control you could use one of the following Task classes and use schedule_task or schedule_task_abs: IntervalTask ThreadedIntervalTask ForkedIntervalTask WeekdayTask ThreadedWeekdayTask ForkedWeekdayTask MonthdayTask ThreadedMonthdayTask ForkedMonthdayTask Kronos is the Greek God of Time. This module is based on Kronos by Irmen de Jong, but has been modified to better fit within TurboGears. Additionally, this module appeared to no longer be supported/in development. N(sEnums sequentialsforkedsthreadeds SchedulercBsztZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d ZRS( sThe Scheduler itself.cCs(t|_titi|i|_dS(N(sTruesselfsrunningsscheds schedulerstimes_Scheduler__delayfunc(sself((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys__init__9s cCs|djoti|n|iidd}ti|}d}||}xJ|i o+|tijo|iidd|joti|qUW|i p|iidd|jodSnti}||joti||ndS(Ni ii( sdelaystimessleepsselfsschedsqueuestoptimesendtimesperiodsstoptimesrunningsnow(sselfsdelaystoptimesnowsperiodsstoptimesendtime((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys __delayfunc=s  8&  cCsdS(N((sself((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys _acquire_lockRscCsdS(N((sself((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys _release_lockSsc Cs|djp |djotdn|tijo t}nA|tijo t }n'|ti jo t }n td| o g}n| o h}n||||||} |i| || SdS(sAdd a new Interval Task to the schedule. A very short initialdelay or one of zero cannot be honored, you will see a slight delay before the task is first executed. This is because the scheduler needs to pick it up in its loop.iisdelay or interval must be >0sinvalid processmethodN(s initialdelaysintervals ValueErrors processmethodsmethods sequentials IntervalTasks TaskClasssthreadedsThreadedIntervalTasksforkedsForkedIntervalTasksargsskwstasknamesactionstasksselfs schedule_task( sselfsactionstasknames initialdelaysintervals processmethodsargsskws TaskClassstask((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pysadd_interval_taskUs"      c Csf|o|otdn| o g}n| o h} n|ov|tijo t} nA|ti jo t } n'|ti jo t } n td| |||||}n|oy|tijo t} nA|ti jo t} n'|ti jo t} n td| |||||| }n|it} |i|| |SdS(s9Add a new Day Task (Weekday or Monthday) to the schedule.s4you can only specify weekdays or monthdays, not bothsinvalid processmethodN(sweekdayss monthdayss ValueErrorsargsskws processmethodsmethods sequentials WeekdayTasks TaskClasssthreadedsThreadedWeekdayTasksforkedsForkedWeekdayTaskstasknames timeondaysactionstasks MonthdayTasksThreadedMonthdayTasksForkedMonthdayTasksget_schedule_timesTrues firsttimesselfsschedule_task_abs( sselfsactionstasknamesweekdayss monthdayss timeondays processmethodsargsstasks TaskClassskws firsttime((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pysadd_daytime_taskls8          cCs|ioJ|iz.|ii|d|ti|f|_ Wd|i Xn+|ii|d|ti|f|_ dS(sSLow-level method to add a new task to the scheduler with the given delay (seconds).iN( sselfsrunnings _acquire_locksschedsentersdelaystasksweakrefsrefsevents _release_lock(sselfstasksdelay((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys schedule_tasks  cCs|ioJ|iz.|ii|d|ti|f|_ Wd|i Xn+|ii|d|ti|f|_ dS(sVLow-level method to add a new task to the scheduler for the given absolute time value.iN( sselfsrunnings _acquire_locksschedsenterabssabstimestasksweakrefsrefsevents _release_lock(sselfstasksabstime((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pysschedule_task_abss  cCs|idS(sStart the scheduler.N(sselfs_run(sself((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pysstartscCst|_g|ii(dS(s0Remove all pending tasks and stop the Scheduler.N(sFalsesselfsrunningsschedsqueue(sself((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pysstops cCs|ii|idS(N(sselfsschedscancelstasksevent(sselfstask((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pyscancelscCsx|ioy|iiWn^tj oR}tidI|IJtidit i ti IJtiddIJnX|iot i dqqWdS(Ns ERROR DURING SCHEDULER EXECUTIONss-ii(sselfsrunningsschedsruns Exceptionsxssyssstderrsjoins tracebacksformat_exceptionsexc_infostimessleep(sselfsx((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys_runs % (s__name__s __module__s__doc__s__init__s_Scheduler__delayfuncs _acquire_locks _release_locksadd_interval_tasksadd_daytime_tasks schedule_tasksschedule_task_abssstartsstopscancels_run(((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys Scheduler6s       "    sTaskcBs;tZdZdZdZdZdZdZRS(s*Abstract base class of all scheduler taskscCs(||_||_||_||_dS(sThis is an abstract class!N(snamesselfsactionsargsskw(sselfsnamesactionsargsskw((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys__init__s    cCsGy|iWn"tj o}|i|nX|i|dS(s2Execute the task action in the scheduler's thread.N(sselfsexecutes Exceptionsxshandle_exceptions reschedules schedulerref(sselfs schedulerrefsx((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys__call__s cCstddS(sLThis is an abstract class, this method is defined in one of the sub classes!sIyou're using the abstract base class 'Task', use a concrete class insteadN(sNotImplementedError(sselfs scheduler((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys reschedulescCs|i|i|idS(sExecute the actual task.N(sselfsactionsargsskw(sself((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pysexecutescCsMtidI|IJtidititiIJtiddIJdS(s8Handle any exception that occured during task execution.sERROR DURING TASK EXECUTIONss-iN(ssyssstderrsexcsjoins tracebacksformat_exceptionsexc_info(sselfsexc((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pyshandle_exceptions%(s__name__s __module__s__doc__s__init__s__call__s reschedulesexecuteshandle_exception(((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pysTasks     s IntervalTaskcBs&tZdZeedZdZRS(s>A repeated task that occurs at certain intervals (in seconds).cCs&ti|||||||_dS(N(sTasks__init__sselfsnamesactionsargsskwsinterval(sselfsnamesintervalsactionsargsskw((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys__init__scCs|i||idS(N(s schedulers schedule_tasksselfsinterval(sselfs scheduler((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys reschedules(s__name__s __module__s__doc__sNones__init__s reschedule(((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys IntervalTasks sDayTaskReschedulercBs)tZdZdZdZdZRS(sBA mixin class that contains the reschedule logic for the DayTasks.cCs ||_dS(N(s timeondaysself(sselfs timeonday((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/scheduler.pys__init__scCstti}|o6|d|df|ijo|dcd7": continue orig_filename = filename if filename.endswith(".pyc"): filename = filename[:-1] try: mtime = os.stat(filename).st_mtime except OSError, e: if orig_filename.endswith('.pyc') and e[0] == errno.ENOENT: # This prevents us from endlessly restarting if there is an old .pyc lying around # after a .py file has been deleted try: os.unlink(orig_filename) except: pass sys.exit(3) # force reload if filename not in mtimes: mtimes[filename] = mtime continue if mtime > mtimes[filename]: sys.exit(3) # force reload time.sleep(freq) cherrypy.lib.autoreload.reloader_thread = reloader_thread webpath = "" DNS_SD = '/usr/bin/dns-sd' DNS_SD_PID = None def start_bonjour(package=None): global DNS_SD_PID if DNS_SD_PID: return if os.path.exists(DNS_SD): # bonjour advertise if not hasattr(cherrypy, "root") or not cherrypy.root: return if not package: package = cherrypy.root.__module__ package = package[:package.find(".")] args = [ DNS_SD, '-R', package + ": " + turbogears.config.get('server.environment'), "_http._tcp", "." + turbogears.config.get('server.socket_host', ''), str(turbogears.config.get('server.socket_port')), "path=/" ] # it might be nice to use subprocess and redirect IO to /dev/null DNS_SD_PID = os.spawnv(os.P_NOWAIT, args[0], args) atexit.register(stop_bonjour) def stop_bonjour(): if not DNS_SD_PID: return try: os.kill(DNS_SD_PID, signal.SIGTERM) except OSError: pass class VirtualPathFilter(object): """Filter that makes CherryPy ignorant of a URL root path. That is, you can mount your app so the URI "/users/~rdel/myapp/" maps to the root object "/". """ def on_start_resource(self): prefix = turbogears.config.get('server.webpath', False) if prefix: path = cherrypy.request.object_path if path == prefix: cherrypy.request.object_path = '/' elif path.startswith(prefix): cherrypy.request.object_path = path[len(prefix):] else: raise cherrypy.NotFound(path) _decoding_validator = NestedVariables() class NestedVariablesFilter(object): def before_main(self): if hasattr(cherrypy.request, "params"): cherrypy.request.params = \ _decoding_validator.to_python(cherrypy.request.params) def startTurboGears(): """Handles TurboGears tasks when the CherryPy server starts. This adds the "tg_js" configuration to make MochiKit accessible. It also turns on stdlib logging when in development mode. """ turbogears.config.update({"/tg_static" : { "static_filter.on" : True, "static_filter.dir" : os.path.abspath(pkg_resources.resource_filename(__name__, "static")), 'log_debug_info_filter.on' : False, } }) turbogears.config.update({"/tg_js" : { "static_filter.on" : True, "static_filter.dir" : os.path.abspath(pkg_resources.resource_filename(__name__, "static/js")), 'log_debug_info_filter.on' : False, } }) cherrypy.config.environments['development']['log_debug_info_filter.on'] = False if turbogears.config.get("decoding_filter.on", path="/") is None: turbogears.config.update({"/": { "decoding_filter.on" : True, "decoding_filter.encoding" : turbogears.config.get( "kid.encoding", "utf8") }}) view.loadBaseTemplates() global webpath webpath = turbogears.config.get("server.webpath", "") if hasattr(cherrypy, "root") and cherrypy.root: if not hasattr(cherrypy.root, "_cp_filters"): cherrypy.root._cp_filters= [] morefilters = [database.EndTransactionsFilter(), NestedVariablesFilter()] if webpath: morefilters.insert(0, VirtualPathFilter()) cherrypy.root._cp_filters.extend(morefilters) if webpath.startswith("/"): webpath = webpath[1:] if webpath and not webpath.endswith("/"): webpath = webpath + "/" isdev = turbogears.config.get('server.environment') == 'development' if not turbogears.config.get("tg.new_style_logging"): if turbogears.config.get('server.log_to_screen'): setuplog = logging.getLogger() setuplog.setLevel(logging.DEBUG) fmt = logging.Formatter("%(asctime)s %(name)s " "%(levelname)s %(message)s") handler = logging.StreamHandler(sys.stdout) handler.setLevel(logging.DEBUG) handler.setFormatter(fmt) setuplog.addHandler(handler) logfile = turbogears.config.get("server.log_file", sys.stdout) setuplog = logging.getLogger("turbogears.access") setuplog.propagate = 0 fmt = logging.Formatter("%(message)s") handler = logging.StreamHandler(logfile) handler.setLevel(logging.INFO) handler.setFormatter(fmt) setuplog.addHandler(handler) bonjoursetting = turbogears.config.get("tg.bonjour", None) if bonjoursetting or isdev: start_bonjour(bonjoursetting) # Start all TurboGears extensions extensions= pkg_resources.iter_entry_points( "turbogears.extensions" ) for entrypoint in extensions: ext= entrypoint.load() if hasattr(ext, "start_extension"): ext.start_extension() for item in call_on_startup: item() if turbogears.config.get("tg.scheduler", False): turbogears.scheduler._start_scheduler() log.info("Scheduler started") def stopTurboGears(): # end all transactions and clear out the hubs to # help ensure proper reloading in autoreload situations for hub in hub_registry: hub.end() hub_registry.clear() stop_bonjour() # Shut down all TurboGears extensions extensions= pkg_resources.iter_entry_points( "turbogears.extensions" ) for entrypoint in extensions: ext= entrypoint.load() if hasattr(ext, "shutdown_extension"): ext.shutdown_extension() for item in call_on_shutdown: item() if turbogears.config.get("tg.scheduler", False): turbogears.scheduler._stop_scheduler() log.info("Scheduler stopped") old_object_trail = _cputil.get_object_trail # hang on to object trail to use it to find an app root if need be def get_object_trail(object_path=None): trail = old_object_trail(object_path) try: cherrypy.request.object_trail = trail except AttributeError: pass return trail _cputil.get_object_trail = get_object_trail class SimpleWSGIServer(CherryPyWSGIServer): """A WSGI server that accepts a WSGI application as a parameter.""" RequestHandlerClass = CPHTTPRequest def __init__(self): conf = cherrypy.config.get wsgi_app = wsgiApp if conf('server.environment') == 'development': try: from paste.evalexception.middleware import EvalException except ImportError: pass else: wsgi_app = EvalException(wsgi_app, global_conf={}) cherrypy.config.update({'server.throw_errors':True}) bind_addr = (conf("server.socket_host"), conf("server.socket_port")) CherryPyWSGIServer.__init__(self, bind_addr, wsgi_app, conf("server.thread_pool"), conf("server.socket_host"), request_queue_size = conf( "server.socket_queue_size"), ) def start_server(root): cherrypy.root = root if turbogears.config.get("tg.fancy_exception", False): cherrypy.server.start(server=SimpleWSGIServer()) else: cherrypy.server.start() if startTurboGears not in cherrypy.server.on_start_server_list: cherrypy.server.on_start_server_list.append(startTurboGears) if stopTurboGears not in cherrypy.server.on_stop_server_list: cherrypy.server.on_stop_server_list.append(stopTurboGears) call_on_startup = [] call_on_shutdown = [] PK:4W :44turbogears/startup.pyc; RDc@sdZdkZdkZdkZdkZdkZdkZdkZdkZdk Z dk l Z dk l Z dk lZlZdklZdkZdklZlZlZdklZeidZeid d Zee ii_d ad Ze a!e d Z"dZ#de$fdYZ%e Z&de$fdYZ'dZ(dZ)e i*Z+e dZ*e*e _*defdYZ,dZ-e(e i.i/joe i.i/i0e(ne)e i.i1joe i.i1i0e)ngZ2gZ3dS(s)Things to do when TurboGears is imported.N(s_cputil(sNestedVariables(swsgiApps CPHTTPRequest(sCherryPyWSGIServer(svisitsdatabasesview(s hub_registrysturbogears.startups TurboGearsc sd} h}tiidttjo dGHdSnxtii i ooPt dt i i}gi}|D]}|t i |q~}nt| t i i}x,t dtd|D] }|idp |d joqn|}|id o|d }nyti|i}Wnetj oY} |id o| d ti joyti!|WqqXnt i"d nX||jo|||1scCs|S(N(sv(sv((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pys5scCst|dtS(Ns__file__(sgetattrsmsNone(sm((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pys5ss.kidss.pyciii(&sarchive_selectorsmtimess turbogearssconfigsgetsNonespackagescherrypyslibs autoreloads RUN_RELOADERsfilterssyssmodulesskeyssmodnamessappends_[1]smodnamesmodlistsmapsvaluessfilenamesendswiths orig_filenamesossstatsst_mtimesmtimesOSErrorseserrnosENOENTsunlinksexitstimessleepsfreq( sfreqsmodnamessmtimes_[1]sfilenames orig_filenamesmtimessmodnamesmodlistsesarchive_selectorspackage((spackagesBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pysreloader_threadsF  2$  ss/usr/bin/dns-sdcCstodSntiitottd pti odSn| o#tii }||i d }ntd|dt i i dddt i i ddtt i i d d g}titi|d |atitndS( Nsroots.s-Rs: sserver.environments _http._tcpsserver.socket_hostssserver.socket_portspath=/i(s DNS_SD_PIDsosspathsexistssDNS_SDshasattrscherrypysrootspackages __module__sfinds turbogearssconfigsgetsstrsargssspawnvsP_NOWAITsatexitsregisters stop_bonjour(spackagesargs((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pys start_bonjourRs T cCsAt odSnytittiWntj onXdS(N(s DNS_SD_PIDsosskillssignalsSIGTERMsOSError(((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pys stop_bonjourjs sVirtualPathFiltercBstZdZdZRS(sFilter that makes CherryPy ignorant of a URL root path. That is, you can mount your app so the URI "/users/~rdel/myapp/" maps to the root object "/". cCstiidt}|oftii}||jodti_q|i |o|t |ti_qti |ndS(Nsserver.webpaths/( s turbogearssconfigsgetsFalsesprefixscherrypysrequests object_pathspaths startswithslensNotFound(sselfsprefixspath((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pyson_start_resourcezs  (s__name__s __module__s__doc__son_start_resource(((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pysVirtualPathFilterss sNestedVariablesFiltercBstZdZRS(NcCs6ttidotitiiti_ndS(Nsparams(shasattrscherrypysrequests_decoding_validators to_pythonsparams(sself((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pys before_mains(s__name__s __module__s before_main(((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pysNestedVariablesFiltersc Cstiihdhdt<dtiitit d<dt <<tiihdhdt<dtiitit d<dt <<t t ii ddtiihd hd t<d tii d d<<ntitii ddatt dot iontt id ogt i_ntitg}to|idtnt iii|ntid otdantotid  otd antii ddj}tii d otii dokti }|i"ti#ti$d}ti&t'i(}|i"ti#|i*||i+|ntii dt'i(}ti d}d|_-ti$d}ti&|}|i"ti.|i*||i+|ntii dt}|p|ot0|nti1d} x8| D]0}|i4} t| do| i6qaqaWxt7D] }|qWtii dt oti9i:t;i<d nd!S("sHandles TurboGears tasks when the CherryPy server starts. This adds the "tg_js" configuration to make MochiKit accessible. It also turns on stdlib logging when in development mode. s /tg_staticsstatic_filter.onsstatic_filter.dirsstaticslog_debug_info_filter.ons/tg_jss static/jss developmentsdecoding_filter.onspaths/sdecoding_filter.encodings kid.encodingsutf8sserver.webpathssroots _cp_filtersiisserver.environmentstg.new_style_loggingsserver.log_to_screens.%(asctime)s %(name)s %(levelname)s %(message)ssserver.log_filesturbogears.accesss %(message)ss tg.bonjoursturbogears.extensionssstart_extensions tg.schedulersScheduler startedN(=s turbogearssconfigsupdatesTruesosspathsabspaths pkg_resourcessresource_filenames__name__sFalsescherrypys environmentssgetsNonesviewsloadBaseTemplatesswebpathshasattrsroots _cp_filterssdatabasesEndTransactionsFiltersNestedVariablesFilters morefilterssinsertsVirtualPathFiltersextends startswithsendswithsisdevsloggings getLoggerssetuplogssetLevelsDEBUGs Formattersfmts StreamHandlerssyssstdoutshandlers setFormatters addHandlerslogfiles propagatesINFOsbonjoursettings start_bonjoursiter_entry_pointss extensionss entrypointsloadsextsstart_extensionscall_on_startupsitems schedulers_start_schedulerslogsinfo( sisdevs morefilterssfmtshandlers entrypointssetuplogsbonjoursettingslogfilesitemsexts extensions((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pysstartTurboGearssjLL>        cCsxtD]}|iqWtittid}x8|D]0}|i }t |do|i qBqBWxt D] }|q}WtiidtotiitidndS(Nsturbogears.extensionssshutdown_extensions tg.schedulersScheduler stopped(s hub_registryshubsendsclears stop_bonjours pkg_resourcessiter_entry_pointss extensionss entrypointsloadsextshasattrsshutdown_extensionscall_on_shutdownsitems turbogearssconfigsgetsFalses schedulers_stop_schedulerslogsinfo(shubsitemsexts entrypoints extensions((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pysstopTurboGearss"    cCs:t|}y|ti_Wntj onX|SdS(N(sold_object_trails object_pathstrailscherrypysrequests object_trailsAttributeError(s object_pathstrail((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pysget_object_trails  sSimpleWSGIServercBstZdZeZdZRS(s=A WSGI server that accepts a WSGI application as a parameter.c Cstii}t}|ddjoVydkl}Wntj oq{X||dh}tii hdt <n|d|df}t i ||||d|dd |d dS( Nsserver.environments development(s EvalExceptions global_confsserver.throw_errorssserver.socket_hostsserver.socket_portsserver.thread_poolsrequest_queue_sizesserver.socket_queue_size(scherrypysconfigsgetsconfswsgiAppswsgi_appspaste.evalexception.middlewares EvalExceptions ImportErrorsupdatesTrues bind_addrsCherryPyWSGIServers__init__sself(sselfs EvalExceptions bind_addrsconfswsgi_app((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pys__init__ s   (s__name__s __module__s__doc__s CPHTTPRequestsRequestHandlerClasss__init__(((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pysSimpleWSGIServers cCsJ|t_tiidtotiidtntiidS(Nstg.fancy_exceptionsserver( srootscherrypys turbogearssconfigsgetsFalsesserversstartsSimpleWSGIServer(sroot((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pys start_servers (4s__doc__sosserrnosloggingssysstimesatexitssignals pkg_resourcesscherrypys_cputilsformencode.variabledecodesNestedVariablesscherrypy._cpwsgiswsgiApps CPHTTPRequestscherrypy._cpwsgiserversCherryPyWSGIServers turbogearssvisitsdatabasesviewsturbogears.databases hub_registrys getLoggerslogsrequiresreloader_threadslibs autoreloadswebpathsDNS_SDsNones DNS_SD_PIDs start_bonjours stop_bonjoursobjectsVirtualPathFilters_decoding_validatorsNestedVariablesFiltersstartTurboGearssstopTurboGearssget_object_trailsold_object_trailsSimpleWSGIServers start_serversserverson_start_server_listsappendson_stop_server_listscall_on_startupscall_on_shutdown(#sSimpleWSGIServers turbogearssreloader_threadsatexits stop_bonjours_decoding_validatorsget_object_trailscherrypyserrnosNestedVariablessvisitsstartTurboGearss start_bonjours hub_registryscall_on_startups_cputilsstopTurboGearsssyssDNS_SDslogs CPHTTPRequestsCherryPyWSGIServersloggings start_serversold_object_trailsdatabasescall_on_shutdownssignalsVirtualPathFilterswsgiApps pkg_resourcesstimesNestedVariablesFiltersossview((sBbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/startup.pys?sR                1    X     PK64BY+ + turbogears/testutil.pyimport inspect import unittest import cStringIO as StringIO import Cookie import cherrypy import sqlobject from sqlobject.inheritance import InheritableSQLObject from cherrypy import _cphttptools from turbogears import database, controllers, startup, validators, config from turbogears.util import get_model config.update({"global" : {"tg.new_style_logging" : True}}) config.update({"global" : {"autoreload.on" : False}}) cherrypy.server.start(serverClass=None, initOnly=True) database.set_db_uri("sqlite:///:memory:") def create_request(request, method="GET", protocol="HTTP/1.1", headers={}, rfile=None, clientAddress="127.0.0.1", remoteHost="localhost", scheme="http"): if not rfile: rfile = StringIO.StringIO("") headerList = [(key, value) for key, value in headers.items()] headerList.append(("Host", "localhost")) if not hasattr(cherrypy.root, "started"): startup.startTurboGears() cherrypy.root.started = True req = _cphttptools.Request(clientAddress, 80, remoteHost, scheme) cherrypy.serving.request = req cherrypy.serving.response = _cphttptools.Response() req.run(" ".join((method, request, protocol)), headerList, rfile) createRequest = create_request def _return_directly(output, *args): return output class DummyRequest: "A very simple dummy request" def __init__(self): self.headers = {} def purge__(self): pass def call(method, *args, **kw): orig_proc_output = controllers._process_output controllers._process_output = _return_directly cherrypy.serving.response = _cphttptools.Response() cherrypy.serving.request = DummyRequest() try: return method(*args, **kw) finally: del cherrypy.serving.request controllers._process_output = orig_proc_output class DBTest(unittest.TestCase): model = None def setUp(self): if not self.model: self.model = get_model() if not self.model: raise "Unable to run database tests without a model" for item in self.model.__dict__.values(): if inspect.isclass(item) and issubclass(item, sqlobject.SQLObject) and item != sqlobject.SQLObject \ and item != InheritableSQLObject: item.createTable(ifNotExists=True) def tearDown(self): database.rollback_all() def reset_cp(): cherrypy.root = None def catch_validation_errors(widget, value): """ Catches and unpacks validation errors. For testing purposes. """ errors = {} try: value = widget.validate(value) except validators.Invalid, e: if hasattr(e, 'unpack_errors'): errors = e.unpack_errors() else: errors = e return value, errors __all__ = ["create_request", "call", "DBTest", "createRequest"] PK:4̴turbogears/testutil.pyc; RDc@spdkZdkZdkZdkZdkZdkZdklZdkl Z dk l Z l Z l Z lZlZdklZeihdhde<<eihdhde<<eiided ee id d d hed dddZeZdZdfdYZdZdeifdYZdZ dZ!ddddgZ"dS(N(sInheritableSQLObject(s _cphttptools(sdatabases controllerssstartups validatorssconfig(s get_modelsglobalstg.new_style_loggings autoreload.ons serverClasssinitOnlyssqlite:///:memory:sGETsHTTP/1.1s 127.0.0.1s localhostshttpc Cs| otid}ngi} |iD]\}} | || fq/~ } | iddft t i d ot i tt i _nti|d||} | t i_tit i_| idi|||f| |dS(NssHosts localhostsstartediPs (srfilesStringIOsappends_[1]sheaderssitemsskeysvalues headerListshasattrscherrypysrootsstartupsstartTurboGearssTruesstarteds _cphttptoolssRequests clientAddresss remoteHostsschemesreqsservingsrequestsResponsesresponsesrunsjoinsmethodsprotocol( srequestsmethodsprotocolsheaderssrfiles clientAddresss remoteHostsschemeskeysreqsvalues_[1]s headerList((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/testutil.pyscreate_requests9  cGs|SdS(N(soutput(soutputsargs((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/testutil.pys_return_directly$ss DummyRequestcBs tZdZdZdZRS(sA very simple dummy requestcCs h|_dS(N(sselfsheaders(sself((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/testutil.pys__init__)scCsdS(N((sself((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/testutil.pyspurge__+s(s__name__s __module__s__doc__s__init__spurge__(((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/testutil.pys DummyRequest's  cOs^ti}tt_titi_t ti_ z|||SWdti` |t_XdS(N(s controllerss_process_outputsorig_proc_outputs_return_directlys _cphttptoolssResponsescherrypysservingsresponses DummyRequestsrequestsmethodsargsskw(smethodsargsskwsorig_proc_output((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/testutil.pyscall.s   sDBTestcBs tZeZdZdZRS(NcCs|i o%t|_|i o dq0nxn|iiiD]Z}ti|o-t|t i o|t i jo |t jo|i dt qCqCWdS(Ns,Unable to run database tests without a models ifNotExists(sselfsmodels get_models__dict__svaluessitemsinspectsisclasss issubclasss sqlobjects SQLObjectsInheritableSQLObjects createTablesTrue(sselfsitem((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/testutil.pyssetUp=s   *cCstidS(N(sdatabases rollback_all(sself((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/testutil.pystearDownIs(s__name__s __module__sNonesmodelssetUpstearDown(((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/testutil.pysDBTest:s cCs tt_dS(N(sNonescherrypysroot(((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/testutil.pysreset_cpLscCshh}y|i|}Wn>tij o/}t|do|i}qZ|}nX||fSdS(s> Catches and unpacks validation errors. For testing purposes. s unpack_errorsN( serrorsswidgetsvalidatesvalues validatorssInvalidseshasattrs unpack_errors(swidgetsvalueserrorsse((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/testutil.pyscatch_validation_errorsOs screate_requestscalls createRequest(#sinspectsunittests cStringIOsStringIOsCookiescherrypys sqlobjectssqlobject.inheritancesInheritableSQLObjects _cphttptoolss turbogearssdatabases controllerssstartups validatorssconfigsturbogears.utils get_modelsupdatesTruesFalsesserversstartsNones set_db_uriscreate_requests createRequests_return_directlys DummyRequestscallsTestCasesDBTestsreset_cpscatch_validation_errorss__all__(scherrypysunittestsstartupscatch_validation_errorss validatorssconfigs__all__sCookiesDBTestscallsdatabasesinspects _cphttptoolss_return_directlysInheritableSQLObjects sqlobjectsreset_cpsStringIOscreate_requests DummyRequests controllerss createRequests get_model((sCbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/testutil.pys?s,        %      PK74B^**turbogears/util.pyimport os import sys from inspect import getargspec, getargvalues from itertools import izip, islice, chain, imap from operator import isSequenceType import pkg_resources import setuptools from cherrypy import request from turbogears.decorator import decorator from turbogears import config # This Enum implementation is from the Python Cookbook and is # written by Zoran Isailovski: # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413486 def Enum(*names): ##assert names, "Empty enums are not supported" # <- Don't like empty enums? Uncomment! class EnumClass(object): __slots__ = names def __iter__(self): return iter(constants) def __len__(self): return len(constants) def __getitem__(self, i): return constants[i] def __repr__(self): return 'Enum' + str(names) def __str__(self): return 'enum ' + str(constants) class EnumValue(object): __slots__ = ('__value') def __init__(self, value): self.__value = value Value = property(lambda self: self.__value) EnumType = property(lambda self: EnumType) def __hash__(self): return hash(self.__value) def __cmp__(self, other): # C fans might want to remove the following assertion # to make all enums comparable by ordinal value {;)) assert self.EnumType is other.EnumType, "Only values from the same enum are comparable" return cmp(self.__value, other.__value) def __invert__(self): return constants[maximum - self.__value] def __nonzero__(self): return bool(self.__value) def __repr__(self): return str(names[self.__value]) maximum = len(names) - 1 constants = [None] * len(names) for i, each in enumerate(names): val = EnumValue(i) setattr(EnumClass, each, val) constants[i] = val constants = tuple(constants) EnumType = EnumClass() return EnumType class setlike(list): """Set preserving item order.""" def add(self, item): if item not in self: self.append(item) def add_all(self, iterable): for item in iterable: self.add(item) def get_package_name(): """Try to find out the package name of the current directory.""" if "--egg" in sys.argv: projectname = sys.argv[sys.argv.index("--egg")+1] egg = pkg_resources.get_distribution(projectname) package = list(egg._get_metadata("top_level.txt"))[0] return package candidates = setuptools.find_packages() if candidates: package = candidates[0] return package def get_project_name(): for i in os.listdir("./"): if i.endswith("egg-info"): return list(open("%s/PKG-INFO" %i))[1][6:-1] def get_model(): package_name = get_package_name() if not package_name: return None package = __import__(package_name, {}, {}, ["model"]) if hasattr(package, "model"): return package.model def ensure_sequence(obj): """Construct a sequence from object.""" if obj is None: return [] elif isSequenceType(obj): return obj else: return [obj] def to_kw(func, args, kw, start=0): """Convert all applicable arguments to keyword arguments.""" argnames, defaults = getargspec(func)[::3] defaults = ensure_sequence(defaults) kw.update(izip(islice(argnames, start, len(argnames) - len(defaults)), args)) return args[len(argnames)-len(defaults)-start:], kw def from_kw(func, args, kw, start=0): """Extract named positional arguments from keyword arguments.""" argnames, defaults = getargspec(func)[::3] defaults = ensure_sequence(defaults) newargs = [kw.pop(name) for name in islice(argnames, start, len(argnames) - len(defaults)) if name in kw] newargs.extend(args) return newargs, kw def adapt_call(func, args, kw, start=0): """Remove excess arguments.""" argnames, varargs, kwargs, defaults = getargspec(func) defaults = ensure_sequence(defaults) del argnames[:start] if kwargs in (None, "_decorator__kwargs"): remove_keys(kw, [key for key in kw.iterkeys() if key not in argnames]) if varargs in (None, "_decorator__varargs"): args = args[:len(argnames) - len(defaults)] else: pivot = len(argnames) - len(defaults) args = tuple(chain(islice(args, pivot), imap(kw.pop, islice( argnames, pivot, None)), islice(args, pivot, None))) return args, kw def call_on_stack(func_name, kw, start=0): """Check if a call to function matching pattern is on stack. """ try: frame = sys._getframe(start+1) except ValueError: return False while frame.f_back: frame = frame.f_back if frame.f_code.co_name == func_name: args = getargvalues(frame)[3] for key in kw.iterkeys(): try: if kw[key] != args[key]: continue except KeyError, TypeError: continue if key or not args: return True return False def arg_index(func, argname): """Find index of argument as declared for given function.""" argnames = getargspec(func)[0] if has_arg(func, argname): return argnames.index(argname) else: return None def has_arg(func, argname): """Check whether function has argument.""" return argname in getargspec(func)[0] def inject_arg(func, argname, argval, args, kw, start=0): """Insert argument into call.""" argnames, defaults = getargspec(func)[::3] defaults = ensure_sequence(defaults) pos = arg_index(func, argname) if pos is None or pos > len(argnames) - len(defaults) - 1: kw[argname] = argval else: pos -= start args = tuple(chain(islice(args, pos), (argval,), islice(args, pos, None))) return args, kw def inject_args(func, injections, args, kw, start=0): """Insert arguments into call.""" for argname, argval in injections.iteritems(): args, kw = inject_arg(func, argname, argval, args, kw, start) return args, kw def inject_call(func, injections, *args, **kw): """Insert arguments and call.""" args, kw = inject_args(func, injections, args, kw) return func(*args, **kw) def bind_args(**add): """Call with arguments set to a predefined value.""" def entagle(func): return lambda func, *args, **kw: inject_call(func, add, *args, **kw) def make_decorator(func): argnames, varargs, kwargs, defaults = getargspec(func) defaults = list(ensure_sequence(defaults)) defaults = [d for d in defaults if argnames[-len(defaults) + defaults.index(d)] not in add] argnames = [arg for arg in argnames if arg not in add] return decorator(entagle, (argnames, varargs, kwargs, defaults))(func) return make_decorator def remove_keys(dict_, seq): """Gracefully remove keys from dict.""" for key in seq: dict_.pop(key, None) return dict_ def recursive_update(to_dict, from_dict): """Recursively update all dicts in to_dict with values from from_dict.""" # probably slow as hell :( should be optimized somehow... for k, v in from_dict.iteritems(): if isinstance(v, dict) and isinstance(to_dict[k], dict): recursive_update(to_dict[k], v) else: to_dict[k] = v return to_dict def combine_contexts(frames=None, depth=None): """Combine contexts (globals, locals) of frames.""" locals_ = {} globals_ = {} if frames is None: frames = [] if depth is not None: frames.extend([sys._getframe(d+1) for d in depth]) for frame in frames: locals_.update(frame.f_locals) globals_.update(frame.f_globals) return locals_, globals_ def request_available(): """Check if cherrypy.request is available.""" try: setattr(request, "tg_dumb_attribute", "testing") except AttributeError: return False else: delattr(request, "tg_dumb_attribute") return True def flatten_sequence(seq): """Flatten sequence.""" for item in seq: if isSequenceType(item) and not isinstance(item, basestring): for item in flatten_sequence(item): yield item else: yield item def load_class(dottedpath): ''' Loads a class from a module in dotted-path notation. Eg: load_class("package.module.class"). Based on recipe 16.3 from "Python Cookbook, 2ed., by Alex Martelli, Anna Martelli Ravenscroft, and David Ascher (O'Reilly Media, 2005) 0-596-00797-3" ''' splitted_path = dottedpath.split('.') modulename = '.'.join(splitted_path[:-1]) classname = splitted_path[-1] try: module = __import__(modulename, globals(), locals(), [classname]) except ImportError: return None return getattr(module, classname) class Bunch(dict): __setattr__ = dict.__setitem__ def __delattr__(self, name): try: del self[name] except KeyError: raise AttributeError def __getattr__(self, name): try: return self[name] except KeyError: raise AttributeError #XXX: Should issue Deprecation warning? DictObj = Bunch DictWrapper = Bunch def parse_http_accept_header(accept): items = [] if accept is None: return items for item in accept.split(","): pos = item.find(";q=") order = 1 if pos > -1: order = float(item[pos+3:].strip()) item = item[:pos].strip() items.append((item, order)) items.sort(lambda i1, i2: cmp(i2[1], i1[1])) return [i[0] for i in items] def to_unicode(value): if isinstance(value, str): # try to make sure we won't get UnicodeDecodeError from the template # by converting all encoded strings to Unicode strings try: value = unicode(value) except UnicodeDecodeError: try: encoding = config.get('kid.encoding', 'utf8') value = unicode(value, encoding) except UnicodeDecodeError: # fail early raise ValueError("Non-unicode string: %r" % value) return value __all__ = ["Enum", "setlike", "get_package_name", "get_model", "url", "ensure_sequence", "has_arg", "DictWrapper", "DictObj", "to_kw", "from_kw", "adapt_call", "call_on_stack", "remove_keys", "arg_index", "inject_arg", "inject_args", "bind_args", "recursive_update", "combine_contexts", "request_available", "flatten_sequence", "load_class", "Bunch", "parse_http_accept_header", "to_unicode", ] PK:4ԻB Q Qturbogears/util.pyc; RDc@sdkZdkZdklZlZdklZlZlZl Z dk l Z dk Z dk Z dklZdklZdklZdZdefd YZd Zd Zd Zd ZddZddZddZddZdZdZ ddZ!ddZ"dZ#dZ$dZ%dZ&e'e'dZ(dZ)dZ*dZ+de,fd YZ-e-Z.e-Z/d!Z0d"Z1d#dd$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8dd9d:gZ2dS(;N(s getargspecs getargvalues(sizipsisliceschainsimap(sisSequenceType(srequest(s decorator(sconfigc sdtfdY}dtfdY}tdtgtx@tD]2\}}||}t |||||!scsS(N(sEnumType(sself(sEnumType(s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys"scCst|iSdS(N(shashsselfs_EnumValue__value(sself((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys__hash__#scCs4|i|ijp tdt|i|iSdS(Ns-Only values from the same enum are comparable(sselfsEnumTypesothersAssertionErrorscmps_EnumValue__value(sselfsother((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys__cmp__$scs|iSdS(N(s constantssmaximumsselfs_EnumValue__value(sself(smaximums constants(s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys __invert__)scCst|iSdS(N(sboolsselfs_EnumValue__value(sself((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys __nonzero__*scst|iSdS(N(sstrsnamessselfs_EnumValue__value(sself(snames(s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys__repr__+s( s__name__s __module__s __slots__s__init__spropertysValuesEnumTypes__hash__s__cmp__s __invert__s __nonzero__s__repr__((snamessmaximums constantssEnumType(s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys EnumValues    i(sobjects EnumClasss EnumValueslensnamessmaximumsNones constantss enumeratesiseachsvalssetattrstuplesEnumType( snamess EnumClasssvalsismaximums EnumValueseachs constantssEnumType((snamessEnumTypesmaximums constantss?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pysEnums"    ssetlikecBs tZdZdZdZRS(sSet preserving item order.cCs"||jo|i|ndS(N(sitemsselfsappend(sselfsitem((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pysadd:s cCs"x|D]}|i|qWdS(N(siterablesitemsselfsadd(sselfsiterablesitem((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pysadd_all>s(s__name__s __module__s__doc__saddsadd_all(((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pyssetlike7s  cCsdtijoMtitiidd}ti|}t|idd}|Snt i }|o|d}|SndS(s:Try to find out the package name of the current directory.s--eggis top_level.txtiN( ssyssargvsindexs projectnames pkg_resourcessget_distributionseggslists _get_metadataspackages setuptoolss find_packagess candidates(spackages projectnames candidatessegg((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pysget_package_nameBs  cCsQxJtidD]9}|ido#ttd|ddd!SqqWdS(Ns./segg-infos %s/PKG-INFOiii(sosslistdirsisendswithslistsopen(si((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pysget_project_nameNscCsPt}| otSnt|hhdg}t|do |iSndS(Nsmodel(sget_package_names package_namesNones __import__spackageshasattrsmodel(s package_namespackage((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys get_modelSs  cCs5|tjogSnt|o|Sn|gSdS(s!Construct a sequence from object.N(sobjsNonesisSequenceType(sobj((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pysensure_sequence\s   icCst|ddd\}}t|}|itt||t |t |||t |t |||fSdS(s6Convert all applicable arguments to keyword arguments.Ni( s getargspecsfuncsargnamessdefaultssensure_sequenceskwsupdatesizipsislicesstartslensargs(sfuncsargsskwsstartsargnamessdefaults((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pysto_kwes  c Cst|ddd\}}t|}gi}t||t |t |D]*}||jo||i |qUqU~}|i|||fSdS(s:Extract named positional arguments from keyword arguments.Ni(s getargspecsfuncsargnamessdefaultssensure_sequencesappends_[1]sislicesstartslensnameskwspopsnewargssextendsargs( sfuncsargsskwsstartsargnamess_[1]sdefaultssnewargssname((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pysfrom_kwms J c Cs!t|\}} }}t|}||4|tdfjoIt |gi }|i D]!}||jo||qXqX~n| tdfjo|t|t| }n\t|t|} ttt|| t|it|| tt|| t}||fSdS(sRemove excess arguments.s_decorator__kwargss_decorator__varargsN(s getargspecsfuncsargnamessvarargsskwargssdefaultssensure_sequencesstartsNones remove_keysskwsappends_[1]siterkeysskeysargsslenspivotstupleschainsislicesimapspop( sfuncsargsskwsstartskeysdefaultsskwargssargnamess_[1]svarargsspivot((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys adapt_callvs I-cCsyti|d}Wntj o tSnXx|io|i}|ii|jo}t |d}xO|i D]A}y ||||jowwnWqwtj o }qwqwXqwW|p| otSqq4q4WtSdS(s:Check if a call to function matching pattern is on stack. iiN(ssyss _getframesstartsframes ValueErrorsFalsesf_backsf_codesco_names func_names getargvaluessargsskwsiterkeysskeysKeyErrors TypeErrorsTrue(s func_nameskwsstarts TypeErrorskeysframesargs((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys call_on_stacks(      cCs9t|d}t||o|i|SntSdS(s6Find index of argument as declared for given function.iN(s getargspecsfuncsargnamesshas_argsargnamesindexsNone(sfuncsargnamesargnames((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys arg_indexs cCs|t|djSdS(s$Check whether function has argument.iN(sargnames getargspecsfunc(sfuncsargname((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pyshas_argsc Cst|ddd\}}t|}t||}|tjp|t |t |djo|||s((sfunc(sadd(s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pysentaglescst|\}}}}tt|}gi}|D]9}|t | |i |jo||q8q8~}gi}|D]!}|jo||qq~}t||||f|SdS(N(s getargspecsfuncsargnamessvarargsskwargssdefaultsslistsensure_sequencesappends_[1]sdslensindexsaddsargs decoratorsentagle(sfuncsvarargssargnamess_[1]sdefaultsskwargssargsd(sentaglesadd(s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pysmake_decorators P8N(sentaglesmake_decorator(saddsentaglesmake_decorator((saddsentagles?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys bind_argss cCs)x|D]}|i|tqW|SdS(s!Gracefully remove keys from dict.N(sseqskeysdict_spopsNone(sdict_sseqskey((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys remove_keyss cCshx]|iD]O\}}t|tot||tot|||q |||.si(sitemssacceptsNonessplitsitemsfindspossordersfloatsstripsappendssorts_[1]si(sacceptsisitemssposs_[1]sitemsorder((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pysparse_http_accept_header#s  cCst|touyt|}Wqtj oRy%tidd}t||}Wqtj otd|qXqXn|SdS(Ns kid.encodingsutf8sNon-unicode string: %r( s isinstancesvaluesstrsunicodesUnicodeDecodeErrorsconfigsgetsencodings ValueError(svaluesencoding((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys to_unicode1ssEnumsget_package_names get_modelsurlsensure_sequenceshas_args DictWrappersDictObjsto_kwsfrom_kws adapt_calls call_on_stacks remove_keyss arg_indexs inject_args inject_argss bind_argssrecursive_updatescombine_contextssrequest_availablesflatten_sequences load_classsparse_http_accept_headers to_unicode(3sosssyssinspects getargspecs getargvaluess itertoolssizipsisliceschainsimapsoperatorsisSequenceTypes pkg_resourcess setuptoolsscherrypysrequeststurbogears.decorators decorators turbogearssconfigsEnumslistssetlikesget_package_namesget_project_names get_modelsensure_sequencesto_kwsfrom_kws adapt_calls call_on_stacks arg_indexshas_args inject_args inject_argss inject_calls bind_argss remove_keyssrecursive_updatesNonescombine_contextssrequest_availablesflatten_sequences load_classsdictsBunchsDictObjs DictWrappersparse_http_accept_headers to_unicodes__all__(*srecursive_updates adapt_calls to_unicodeschainsizipsto_kwscombine_contextssensure_sequences__all__s call_on_stacks inject_argsEnumsDictObjsisSequenceTypesfrom_kwsflatten_sequences getargvaluessparse_http_accept_headers getargspecsconfigs inject_calls inject_argss load_classsget_project_names bind_argsssyss DictWrappersislicesget_package_nameshas_argsimaps decoratorsrequest_availablessetlikes arg_indexsrequests pkg_resourcess get_models remove_keyss setuptoolssossBunch((s?build/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/util.pys?sJ         $              PK74sځturbogears/validators.py"""Convenient validators and converters for data coming in from the web. This module also imports everything from formencode.validators, so all common validation routines are available here.""" import time from datetime import datetime import cgi # FieldStorageUploadConverter import simplejson from formencode.validators import * from formencode.compound import * from formencode.api import Invalid, NoDefault from formencode.schema import Schema from formencode import ForEach from turbogears.i18n import format from turbojson import jsonify from formencode import validators # Needed to disambiguate the Number validator... class Money(FancyValidator): messages = { 'badFormat': 'Invalid number format', 'empty': 'Empty values not allowed', } def __init__(self, allow_empty = False, *args, **kwargs): self.allow_empty = allow_empty def _to_python(self, value, state): """ parse a string and returns a float or integer """ if self.allow_empty and not value: return None elif not self.allow_empty and not value: raise Invalid(self.message('empty', state), value, state) else: try: return format.parse_decimal(value) except ValueError: raise Invalid(self.message('badFormat', state), value, state) def _from_python(self, value, state): """ returns a string using the correct grouping """ if self.allow_empty and not value: return None else: return format.format_currency(value) class Number(FancyValidator): def _to_python(self, value, state): """ parse a string and returns a float or integer """ try: value = format.parse_decimal(value) except ValueError: pass nb = validators.Number() return nb._to_python(value, state) def _from_python(self, value, state): """ returns a string using the correct grouping """ try: decimal_part = str(value).split('.')[1] dec_places = len(decimal_part) return format.format_decimal(value, dec_places) except IndexError: return format.format_number(value) class DateTimeConverter(FancyValidator): messages = { 'badFormat': 'Invalid datetime format', 'empty': 'Empty values not allowed', } def __init__(self, format = "%Y/%m/%d %H:%M", allow_empty=False, *args, **kwargs): self.format = format self.allow_empty = allow_empty def _to_python(self, value, state): """ parse a string and return a datetime object. """ if self.allow_empty and not value: return None if value and isinstance(value, datetime): return value elif not self.allow_empty and not value: raise Invalid(self.message('empty', state), value, state) else: try: tpl = time.strptime(value, self.format) except ValueError: raise Invalid(self.message('badFormat', state), value, state) # shoudn't use time.mktime() because it can give OverflowError, # depending on the date (e.g. pre 1970) and underlying C library return datetime(year=tpl.tm_year, month=tpl.tm_mon, day=tpl.tm_mday, hour=tpl.tm_hour, minute=tpl.tm_min, second=tpl.tm_sec) def _from_python(self, value, state): if self.allow_empty and not value: return None else: return value.strftime(self.format) # formencode trunk already contains UnicodeString but we # provide our own version because formencode's version may be broken # remove this when formencode.validators.UnicodeString will be identical to ours. class UnicodeString(String): encoding = 'utf-8' def _to_python(self, value, state): if value: if isinstance(value, unicode): return value if hasattr(value, '__unicode__'): return unicode(value) return unicode(value, self.encoding) return u'' def _from_python(self, value, state): if hasattr(value, '__unicode__'): value = unicode(value) if isinstance(value, unicode): return value.encode(self.encoding) return str(value) # another formencode workaround, # see #1464357 on FE bugtracker (http://tinyurl.com/lm9ae). # Custom version of FieldStorage validator that does not break FE schema validator. class FieldStorageUploadConverter(FancyValidator): def to_python(self, value, state=None): if isinstance(value, cgi.FieldStorage): if value.filename: return value raise Invalid('invalid', value, state) else: return value class MultipleSelection(ForEach): if_missing = NoDefault if_empty = [] def to_python(self, value, state=None): try: return super(MultipleSelection, self).to_python(value, state) except Invalid: raise Invalid("Please select at least a value", value, state) class Schema(Schema): """ A Schema validator """ filter_extra_fields = True allow_extra_fields = True if_key_missing = None class JSONValidator(FancyValidator): def _from_python(self, value, state): return jsonify.encode(value) def _to_python(self, value, state): return simplejson.loads(value) PK:4ĝ % %turbogears/validators.pyc; RDc@sDdZdkZdklZdkZdkZdkTdkTdklZl Z dk l Z dk l Z dklZdklZd k lZd efd YZd efd YZdefdYZdefdYZdefdYZde fdYZde fdYZ defdYZdS(sConvenient validators and converters for data coming in from the web. This module also imports everything from formencode.validators, so all common validation routines are available here.N(sdatetime(s*(sInvalids NoDefault(sSchema(sForEach(sformat(sjsonify(s validatorssMoneycBs>tZhdd<ddturbogears/command/__init__.pyc; RDc@sdklZdS((smainN(sturbogears.command.basesmain(smain((sKbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/__init__.pys?sPK54!G$$turbogears/command/base.py"Commands for the TurboGears command line tool." import optparse import sys import os import os.path import glob import pkg_resources import turbogears from turbogears.util import get_model, get_package_name sys.path.insert(0, os.getcwd()) no_connection_param = ["help", "list"] no_model_param = ["help"] def silent_os_remove(fname): """ Tries to remove file FNAME but mutes any error that may happen. Returns True if file was actually removed and false otherwise """ try: os.remove(fname) return True except os.error: pass return False def get_project_config(): """Tries to select appropriate project configuration file.""" config = None if os.path.exists("setup.py"): config = "dev.cfg" else: config = "prod.cfg" return config def load_project_config(config=None): """Tries to update the config, loading project settings from the config file specified. If config is C{None} uses L{get_project_config} to locate one. """ if config is None: config = get_project_config() if not os.path.isfile(config): print 'config file %s not found or is not a file.' % config return package = get_package_name() turbogears.update_config(configfile=config, modulename = package + ".config") class CommandWithDB(object): "Base class for commands that need to use the database" config = None def __init__(self, version): pass def find_config(self): """Chooses the config file, trying to guess whether this is a development or installed project.""" load_project_config(self.config) self.dburi = turbogears.config.get("sqlobject.dburi", None) if self.dburi and self.dburi.startswith("notrans_"): self.dburi = self.dburi[8:] class SQL(CommandWithDB): """Wrapper command for sqlobject-admin. This automatically supplies sqlobject-admin with the database that is found in the config file. Will also supply the model module as appropriate.""" desc = "Run the SQLObject manager" def __init__(self, version): if len(sys.argv) == 1 or sys.argv[1][0] == "-": parser = optparse.OptionParser( usage="%prog sql [turbogears options] [sqlobject command] " \ "[sqlobject options]\n" \ "HINT: '%prog sql help' will list the sqlobject " \ "commands", version="%prog " + version) parser.add_option("-c", "--config", help="config file", dest="config") (options, args) = parser.parse_args(sys.argv[1:3]) if not options.config: parser.error("Please provide a valid option or sqlobject command.") self.config = options.config # get rid of our config option if not args: del sys.argv[1:3] else: del sys.argv[1] self.find_config() def run(self): "Executes the sqlobject-admin code." if not "--egg" in sys.argv and not turbogears.util.get_project_name(): print "this don't look like a turbogears project" return else: sqlobjcommand = sys.argv[1] if sqlobjcommand not in no_connection_param: if not self.dburi: print """Database URI not specified in the config file (%s). Please be sure it's on the command line.""" % self.config else: print "Using database URI %s" % self.dburi sys.argv.insert(2, self.dburi) sys.argv.insert(2, "-c") if sqlobjcommand not in no_model_param: if not "--egg" in sys.argv: eggname = glob.glob("*.egg-info") if not eggname or not \ os.path.exists(os.path.join(eggname[0], "sqlobject.txt")): eggname = self.fix_egginfo(eggname) eggname = eggname[0].replace(".egg-info", "") if not "." in sys.path: sys.path.append(".") pkg_resources.working_set.add_entry(".") sys.argv.insert(2, eggname) sys.argv.insert(2, "--egg") from sqlobject.manager import command command.the_runner.run(sys.argv) def fix_egginfo(self, eggname): print """ This project seems incomplete. In order to use the sqlobject commands without manually specifying a model, there needs to be an egg-info directory with an appropriate sqlobject.txt file. I can fix this automatically. Would you like me to? """ dofix = raw_input("Enter [y] or n: ") if not dofix or dofix.lower()[0] == 'y': oldargs = sys.argv sys.argv = ["setup.py", "egg_info"] import imp imp.load_module("setup", *imp.find_module("setup", ["."])) sys.argv = oldargs import setuptools package = setuptools.find_packages()[0] eggname = glob.glob("*.egg-info") sqlobjectmeta = open(os.path.join(eggname[0], "sqlobject.txt"), "w") sqlobjectmeta.write("""db_module=%(package)s.model history_dir=$base/%(package)s/sqlobject-history """ % dict(package=package)) else: sys.exit(0) return eggname class Shell(CommandWithDB): """Convenient version of the Python interactive shell. This shell attempts to locate your configuration file and model module so that it can import everything from your model and make it available in the Python shell namespace.""" desc = "Start a Python prompt with your database available" def run(self): "Run the shell" if not turbogears.util.get_project_name(): print "this don't look like a turbogears project" return else: self.find_config() mod = get_model() if mod: locals = mod.__dict__ else: locals = dict(__name__="tg-admin") try: # try to use IPython if possible import IPython shell = IPython.Shell.IPShell(user_ns=locals) shell.mainloop() except ImportError: import code code.interact(local=locals) class ToolboxCommand(CommandWithDB): desc = "Launch the TurboGears Toolbox" def __init__(self, version): self.hostlist = ['127.0.0.1','::1'] parser = optparse.OptionParser( usage="%prog toolbox [-o]", version="%prog " + version) parser.add_option("-n", "--no-open", help="don't open browser automatically", dest="noopen", action="store_true", default=False) parser.add_option("-c", "--add-client", help="allow the client ip address specified to connect to catwalk (Can be specified more than once)", dest="host", action="append", default=None) (options, args) = parser.parse_args(sys.argv[1:]) self.noopen = options.noopen if options.host: self.hostlist = self.hostlist + options.host turbogears.widgets.load_widgets() def openbrowser(self): import webbrowser webbrowser.open("http://localhost:7654") def run(self): self.find_config() from turbogears.toolbox.catwalk import CatWalk import cherrypy from turbogears import toolbox root = toolbox.Toolbox() model = get_model() if model: root.catwalk = CatWalk(model, self.hostlist) cherrypy.root = root turbogears.config.update({"global" : { "server.socket_port" : 7654, "server.environment" : "development", "server.log_to_screen" : True, "autoreload.on" : False, "server.package" : "turbogears.toolbox", "log_debug_info_filter.on" : False }}) if not self.noopen: cherrypy.server.start_with_callback(self.openbrowser) else: print "Running server on port 7654." cherrypy.server.start() commands = None def main(): "Main command runner. Manages the primary command line arguments." # add commands defined by entrypoints commands = {} for entrypoint in pkg_resources.iter_entry_points("turbogears.command"): command = entrypoint.load() commands[entrypoint.name] = (command.desc, entrypoint) if len(sys.argv) == 1 or sys.argv[1] == "--help-commands" or \ sys.argv[1] == "--help" or not commands.has_key(sys.argv[1]): print """ TurboGears %s command line interface Usage: %s [command] [options] Available commands:""" % (turbogears.__version__, sys.argv[0]) longest = max([len(key) for key in commands.keys()]) format = "%" + str(longest) + "s %s" commandlist = commands.keys() commandlist.sort() for key in commandlist: print format % (key, commands[key][0]) sys.exit(0) commandname = sys.argv[1] del sys.argv[1] command = commands[commandname][1] command = command.load()(turbogears.__version__) command.run() __all__ = ["main"] PK:4a:5x22turbogears/command/base.pyc; RDc@sdZdkZdkZdkZdkZdkZdkZdkZdkl Z l Z ei i dei ddgZdgZdZdZedZd efd YZd efd YZd efdYZdefdYZeZdZdgZdS(s.Commands for the TurboGears command line tool.N(s get_modelsget_package_nameishelpslistcCs6yti|tSWntij onXtSdS(s Tries to remove file FNAME but mutes any error that may happen. Returns True if file was actually removed and false otherwise N(sossremovesfnamesTrueserrorsFalse(sfname((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pyssilent_os_removes cCs1t}tiido d}nd}|SdS(s7Tries to select appropriate project configuration file.ssetup.pysdev.cfgsprod.cfgN(sNonesconfigsosspathsexists(sconfig((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pysget_project_config s  cCsf|tjo t}ntii| od|GHdSnt}ti d|d|ddS(sTries to update the config, loading project settings from the config file specified. If config is C{None} uses L{get_project_config} to locate one. s*config file %s not found or is not a file.Ns configfiles modulenames.config( sconfigsNonesget_project_configsosspathsisfilesget_package_namespackages turbogearss update_config(sconfigspackage((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pysload_project_config*s     s CommandWithDBcBs&tZdZeZdZdZRS(s5Base class for commands that need to use the databasecCsdS(N((sselfsversion((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pys__init__<scCsZt|itiidt|_|io|iido|id|_ndS(sdChooses the config file, trying to guess whether this is a development or installed project.ssqlobject.dburisnotrans_iN(sload_project_configsselfsconfigs turbogearssgetsNonesdburis startswith(sself((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pys find_config?s  (s__name__s __module__s__doc__sNonesconfigs__init__s find_config(((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pys CommandWithDB8s  sSQLcBs/tZdZdZdZdZdZRS(sWrapper command for sqlobject-admin. This automatically supplies sqlobject-admin with the database that is found in the config file. Will also supply the model module as appropriate.sRun the SQLObject managercCsttidjptidddjotidddd|}|idd d d d d |itidd!\}}|i o|i dn|i |_ | otidd5qtid=n|idS(Niis-susages~%prog sql [turbogears options] [sqlobject command] [sqlobject options] HINT: '%prog sql help' will list the sqlobject commandssversions%prog s-cs--configshelps config filesdestsconfigis3Please provide a valid option or sqlobject command.(slenssyssargvsoptparses OptionParsersversionsparsers add_options parse_argssoptionssargssconfigserrorsselfs find_config(sselfsversionsargssparsersoptions((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pys__init__Ps.    cCsdtij otii o dGHdSnwtid}|tjoT|i od|i GHqd|iGHtii d|itii ddn|t jodtij ot i d }| p$tiitii|d d  o|i|}n|d id d }dtij o$tiidtiidntii d|tii ddqndkl}|iitidS(s"Executes the sqlobject-admin code.s--eggs)this don't look like a turbogears projectNisdDatabase URI not specified in the config file (%s). Please be sure it's on the command line.sUsing database URI %sis-cs *.egg-infois sqlobject.txts .egg-infoss.(scommand(ssyssargvs turbogearssutilsget_project_names sqlobjcommandsno_connection_paramsselfsdburisconfigsinsertsno_model_paramsglobseggnamesosspathsexistssjoins fix_egginfosreplacesappends pkg_resourcess working_sets add_entryssqlobject.managerscommands the_runnersrun(sselfs sqlobjcommandseggnamescommand((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pysrungs0"     / cCsdGHtd}| p|iddjoti}ddgt_dk}|id|iddg|t_dk }|i d}t i d }ttii|dd d }|id td |ntid|SdS(Ns This project seems incomplete. In order to use the sqlobject commands without manually specifying a model, there needs to be an egg-info directory with an appropriate sqlobject.txt file. I can fix this automatically. Would you like me to? sEnter [y] or n: isyssetup.pysegg_infossetups.s *.egg-infos sqlobject.txtswsLdb_module=%(package)s.model history_dir=$base/%(package)s/sqlobject-history spackage(s raw_inputsdofixslowerssyssargvsoldargssimps load_modules find_modules setuptoolss find_packagesspackagesglobseggnamesopensosspathsjoins sqlobjectmetaswritesdictsexit(sselfseggnamesimpspackages sqlobjectmetasdofixsoldargss setuptools((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pys fix_egginfos     " (s__name__s __module__s__doc__sdescs__init__sruns fix_egginfo(((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pysSQLGs   !sShellcBstZdZdZdZRS(sConvenient version of the Python interactive shell. This shell attempts to locate your configuration file and model module so that it can import everything from your model and make it available in the Python shell namespace.s2Start a Python prompt with your database availablecCstii o dGHdSn|it}|o |i}nt dd}y,dk }|i i d|}|iWn,tj o dk}|id|nXdS(s Run the shells)this don't look like a turbogears projectNs__name__stg-adminsuser_nsslocal(s turbogearssutilsget_project_namesselfs find_configs get_modelsmods__dict__slocalssdictsIPythonsShellsIPShellsshellsmainloops ImportErrorscodesinteract(sselfscodesshellsIPythonslocalssmod((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pysruns      (s__name__s __module__s__doc__sdescsrun(((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pysShells sToolboxCommandcBs)tZdZdZdZdZRS(NsLaunch the TurboGears Toolboxc Csddg|_tidddd|}|iddd d d d d ddt|iddd dd dd ddt|i t i d\}}|i|_|io|i|i|_ntiidS(Ns 127.0.0.1s::1susages%prog toolbox [-o]sversions%prog s-ns --no-openshelps don't open browser automaticallysdestsnoopensactions store_truesdefaults-cs --add-clients]allow the client ip address specified to connect to catwalk (Can be specified more than once)shostsappendi(sselfshostlistsoptparses OptionParsersversionsparsers add_optionsFalsesNones parse_argsssyssargvsoptionssargssnoopenshosts turbogearsswidgetss load_widgets(sselfsversionsargssparsersoptions((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pys__init__s      cCsdk}|iddS(Nshttp://localhost:7654(s webbrowsersopen(sselfs webbrowser((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pys openbrowsers cCs|idkl}dk}dkl}|i}t }|o|||i |_ n||_ti ihdhdd<dd<dt<d t<d d <d t<<|i o|ii|ind GH|iidS(N(sCatWalk(stoolboxsglobalsserver.socket_portisserver.environments developmentsserver.log_to_screens autoreload.onsserver.packagesturbogears.toolboxslog_debug_info_filter.onsRunning server on port 7654.(sselfs find_configsturbogears.toolbox.catwalksCatWalkscherrypys turbogearsstoolboxsToolboxsroots get_modelsmodelshostlistscatwalksconfigsupdatesTruesFalsesnoopensserversstart_with_callbacks openbrowsersstart(sselfsCatWalkscherrypysmodelsrootstoolbox((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pysruns       O (s__name__s __module__sdescs__init__s openbrowsersrun(((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/base.pysToolboxCommands  c Csh}x9tidD](}|i}|i|f||i Available commands: add Creates a message catalog for specified locale collect Scan source files to gather translatable strings in a .pot file merge Sync message catalog in different languages with .pot file compile Compile message catalog (.po -> .mo) clean Delete backups and compiled files """, version="%prog " + self.__version__) parser.add_option("-f", "--force", default=False, action="store_true", dest="force_ops", help="force potentially damaging actions") parser.add_option("-K", "--no-kid-support", default=True, action="store_false", dest="kid_support", help="Do not extract messages from Kid templates") parser.add_option("", "--loose-kid-support", action="store_true", dest="loose_kid_support", help="Extract ALL messages from Kid templates" \ " (this is default)") parser.add_option("", "--strict-kid-support", action="store_false", dest="loose_kid_support", help="Extract only messages marked with lang attribute " \ "from Kid templates") parser.set_defaults(loose_kid_support=True) self.parser = parser def load_project_config(self): """Chooses the config file, trying to guess whether this is a development or installed project.""" # defaults self.localeDir = 'locales' self.domain = 'messages' # check whether user specified custom settings load_project_config() if turbogears.config.get("i18n.localeDir"): self.localeDir = turbogears.config.get("i18n.localeDir") print 'Use %s as a locale directory' % self.localeDir if turbogears.config.get('i18n.domain'): self.domain = turbogears.config.get("i18n.domain") print 'Use %s as a message domain' % self.domain if os.path.exists(self.localeDir) and \ not os.path.isdir(self.localeDir): raise ProgramError, \ ('%s is not a directory' % self.localeDir) if not os.path.exists(self.localeDir): os.makedirs(self.localeDir) def parse_args(self): return self.parser.parse_args() def run(self): self.load_project_config() (options, args) = self.parse_args() if not args: self.parser.error("No command specified") self.options = options command, args = args[0], args[1:] if 'collect' == command: self.scan_source_files() elif 'add' == command: self.add_languages(args) elif 'compile' == command: self.compile_message_catalogs() elif 'merge' == command: self.merge_message_catalogs() elif 'clean' == command: self.clean_generated_files() else: self.parser.error("Command not recognized") def clean_generated_files(self): potfile = self.get_potfile_path() silent_os_remove(potfile.replace('.pot', '.bak')) for fname in self.list_message_catalogs(): silent_os_remove(fname.replace('.po', '.mo')) silent_os_remove(fname.replace('.po', '.back')) def merge_message_catalogs(self): potfile = self.get_potfile_path() catalogs = self.list_message_catalogs() catalog.merge(potfile, catalogs) def compile_message_catalogs(self): for fname in self.list_message_catalogs(): dest = fname.replace('.po','.mo') msgfmt.make(fname, dest) if os.path.exists(dest): print 'Compiled %s OK' % fname else: print 'Compilation of %s failed!' % fname def add_languages(self, codes): potfile = self.get_potfile_path() if not os.path.isfile(potfile): print "Run 'collect' first to create", potfile return for code in codes: catalog_file = self.get_locale_catalog(code) langdir = os.path.dirname(catalog_file) if not os.path.exists(langdir): os.makedirs(langdir) if os.path.exists(catalog_file) and not self.options.force_ops: print "File %s exists, use --force to override" % catalog_file continue shutil.copy(potfile, catalog_file) print 'Copy', potfile, 'to', catalog_file def scan_source_files(self): source_files = [] kid_files = [] for dir in self.get_source_dirs(): print 'Scanning source directory', dir for root, dirs, files in os.walk(dir): if os.path.basename(root).lower() in ('CVS', '.svn'): continue for fname in files: name,ext = os.path.splitext(fname) srcfile = os.path.join(root, fname) if ext == '.py': source_files.append(srcfile) elif ext == '.kid': kid_files.append(srcfile) #print 'add', srcfile else: pass # do nothing (tmp_handle, tmp_potfile) = tempfile.mkstemp('.pot', 'tmp', self.localeDir) os.close(tmp_handle) potbasename = os.path.basename(tmp_potfile)[:-4] pygettext.sys.argv = ['','-v', '-d', potbasename, \ '-p', os.path.dirname(tmp_potfile)] + source_files pygettext.main() if not os.path.exists(tmp_potfile): raise ProgramError, 'pygettext failed' atexit.register(silent_os_remove, tmp_potfile) self.fix_tzinfo(tmp_potfile) if kid_files and self.options.kid_support: self.scan_kid_files(tmp_potfile, kid_files) potfile = self.get_potfile_path() if os.path.isfile(potfile): bakfile = potfile.replace('.pot', '.bak') silent_os_remove(bakfile) os.rename(potfile, bakfile) print 'Backup existing file to', bakfile os.rename(tmp_potfile, potfile) print 'Message templates written to', potfile def scan_kid_files(self, potfile, files): messages = [] tags_to_ignore = ['script', 'style'] keys = {} kid_expr_re = re.compile('\${[^{]+}') for fname in files: print 'working on', fname tree = None try: tree = ElementTree(file=fname).getroot() except Exception, e: print 'Skip %s: %s' % (fname, e) continue for el in tree.getiterator(): if el.text and \ (self.options.loose_kid_support or el.get('lang')): key = el.text.strip() tag = re.sub('({[^}]+})?(\w+)', '\\2', el.tag) if key and (not kid_expr_re.match(key)) and \ (key not in keys) and (tag not in tags_to_ignore): messages.append((tag, fname, key)) keys[key] = 1 fd = open(potfile, 'at+') for tag,fname,text in messages: text = normalize(text.encode('utf-8')) print >>fd, '#: %s:%s' % (fname, tag) print >>fd, 'msgid %s' % text print >>fd, 'msgstr ""' print >>fd, '' fd.close() def get_potfile_path(self): return os.path.join(self.localeDir, '%s.pot' % self.domain) def get_locale_catalog(self, code): return os.path.join(self.localeDir, code, 'LC_MESSAGES', '%s.po' % self.domain) def list_message_catalogs(self): files = [] for name in glob.glob(self.localeDir + '/*'): if os.path.isdir(name): fname = os.path.join(name, 'LC_MESSAGES', '%s.po' % self.domain) if os.path.isfile(fname): files.append(fname) return files def get_source_dirs(self): if turbogears.config.get('i18n_tool.source_dirs'): return turbogears.config.get('i18n_tool.source_dirs') return get_project_source_dirs() def fix_tzinfo(self, potfile): """ In certain enviroments, tz info as formatted by strftime() is not utf-8. E.g. Windows XP with russian MUL. This leads to later error when a program trying to read catalog. """ data = file(potfile, 'rb').read() def repl(m): "Remove tzinfo if it breaks encoding." tzinfo = m.group(2) try: tzinfo.decode('utf-8') except UnicodeDecodeError, e: return m.group(1) # cut tz info return m.group(0) # leave unchanged data = re.sub("(POT-Creation-Date: [\d-]+ [0-9:]+)\+([^\\\\]+)", repl, data) file(potfile, 'wb').write(data) def main(): tool = InternationalizationTool() tool.run() if __name__ == '__main__': main() PK:4rs 8 8turbogears/command/i18n.pyc; RDc@sdZdkZdkZdkZdkZdkZdkZdkZdkZdk l Z dk Z dk Z dk lZlZlZdklZlZdklZlZdefdYZdZd fd YZd Zed jo endS( s4Command-line user interface for i18n administration.N(s ElementTree(s pygettextsmsgfmtscatalog(squotes normalize(sload_project_configssilent_os_removes ProgramErrorcBstZdZRS(s*Signals about a general application error.(s__name__s __module__s__doc__(((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/i18n.pys ProgramErrors cCs[tid}g}x;|D]3}x*t|D]}|i|idq/WqW|SdS(Ns*.egg-info/top_level.txts (sglobsfnamessnamessfnamesfileslinesappendsstrip(sfnamesfnamessnamessline((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/i18n.pysget_project_source_dirss sInternationalizationToolcBstZdZdZeZeZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZRS(s-Manages i18n data via command-line interface.sManage i18n datas0.2s)Max Ischenko, U{http://maxischenko.in.ua}sischenko@gmail.coms Copyright 2005-2006 Max IschenkosMITc Cstidddd|i}|idddtdd d d d d |idddtddd dd d|idddd d dd d|iddddd dd d|idt||_dS(Nsusagesq %prog [options] Available commands: add Creates a message catalog for specified locale collect Scan source files to gather translatable strings in a .pot file merge Sync message catalog in different languages with .pot file compile Compile message catalog (.po -> .mo) clean Delete backups and compiled files sversions%prog s-fs--forcesdefaultsactions store_truesdests force_opsshelps"force potentially damaging actionss-Ks--no-kid-supports store_falses kid_supports*Do not extract messages from Kid templatesss--loose-kid-supportsloose_kid_supports9Extract ALL messages from Kid templates (this is default)s--strict-kid-supportsCExtract only messages marked with lang attribute from Kid templates( soptparses OptionParsersselfs __version__sparsers add_optionsFalsesTrues set_defaults(sselfsversionsparser((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/i18n.pys__init__0s            cCsd|_d|_ttiido%tiid|_d|iGHntiido%tiid|_d|iGHntii |iotii |i ot d|intii |i oti |indS( sdChooses the config file, trying to guess whether this is a development or installed project.slocalessmessagessi18n.localeDirsUse %s as a locale directorys i18n.domainsUse %s as a message domains%s is not a directoryN( sselfs localeDirsdomainsload_project_configs turbogearssconfigsgetsosspathsexistssisdirs ProgramErrorsmakedirs(sself((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/i18n.pysload_project_configLs  -cCs|iiSdS(N(sselfsparsers parse_args(sself((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/i18n.pys parse_argsfscCs|i|i\}}| o|iidn||_|d|df\}}d|jo|ind|jo|i |nbd|jo|i nGd|jo|i n,d|jo|i n|iid dS( NsNo command specifiediiscollectsaddscompilesmergescleansCommand not recognized( sselfsload_project_configs parse_argssoptionssargssparserserrorscommandsscan_source_filess add_languagesscompile_message_catalogssmerge_message_catalogssclean_generated_files(sselfsargsscommandsoptions((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/i18n.pysrunis"       cCsi|i}t|iddx@|iD]2}t|iddt|iddq/WdS(Ns.pots.baks.pos.mos.back(sselfsget_potfile_pathspotfilessilent_os_removesreplaceslist_message_catalogssfname(sselfspotfilesfname((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/i18n.pysclean_generated_files|s   cCs,|i}|i}ti||dS(N(sselfsget_potfile_pathspotfileslist_message_catalogsscatalogsscatalogsmerge(sselfspotfilescatalogs((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/i18n.pysmerge_message_catalogss  cCsfx_|iD]Q}|idd}ti||tii |o d|GHq d|GHq WdS(Ns.pos.mosCompiled %s OKsCompilation of %s failed!( sselfslist_message_catalogssfnamesreplacesdestsmsgfmtsmakesosspathsexists(sselfsdestsfname((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/i18n.pyscompile_message_catalogss  cCs|i}tii| odG|GHdSnx|D]}|i|}tii |}tii | oti |ntii |o |ii od|GHq8nti||dG|GdG|GHq8WdS(NsRun 'collect' first to creates'File %s exists, use --force to overridesCopysto(sselfsget_potfile_pathspotfilesosspathsisfilescodesscodesget_locale_catalogs catalog_filesdirnameslangdirsexistssmakedirssoptionss force_opssshutilscopy(sselfscodesspotfileslangdirscodes catalog_file((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/i18n.pys add_languagess  ! cCsIg}g} x|iD]}dG|GHxti|D]\}} }ti i |i ddfjoq8nxw|D]o}ti i|\} }ti i||}|djo|i|qz|djo| i|qzqzWq8WqWtidd|i\}} ti|ti i | d } d d d | d ti i| g|ti_titi i |  o t!d nt"i#t$| |i%| | o |i&i'o|i(| | n|i)}ti i+|o9|i,dd}t$|ti.||dG|GHnti.| |dG|GHdS(NsScanning source directorysCVSs.svns.pys.kids.potstmpiss-vs-ds-pspygettext faileds.baksBackup existing file tosMessage templates written to(/s source_filess kid_filessselfsget_source_dirssdirsosswalksrootsdirssfilesspathsbasenameslowersfnamessplitextsnamesextsjoinssrcfilesappendstempfilesmkstemps localeDirs tmp_handles tmp_potfilescloses potbasenamesdirnames pygettextssyssargvsmainsexistss ProgramErrorsatexitsregisterssilent_os_removes fix_tzinfosoptionss kid_supportsscan_kid_filessget_potfile_pathspotfilesisfilesreplacesbakfilesrename(sselfsfilessroots tmp_handlespotfilessrcfilesextsfnames source_filess kid_filessdirss tmp_potfilesnames potbasenamesbakfilesdir((sGbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/i18n.pysscan_source_filessJ  %    .      cCsg}ddg} h}tid}x|D]} dG| GHt}yt d| i }Wn't j o}d| |fGHq.nXx|iD]}|io|iip |ido|ii}tidd |i} |o(|i| o||jo | | jo$|i| | |fd ||tZdZdZeZeZdZeZdZ dZ RS(sImplementation of quickstart.sCreate a new TurboGears projects turbogearsc Cstidddd|}|iddddd d |id dd d dd d|iddddd dd|i|iddddd dd|i|i\}}|i i |i |o|d|_ n||_dS(Nsusages)%prog quickstart [options] [project name]sversions%prog s-ps --packageshelpspackage name for the codesdestspackages --dry-runs$dry run (don't actually do anything)sactions store_truesdry_runs-ts --templatessuser specific templatess templatessdefaults-is --identitys@identity provider to use (sqlobject (default), sqlalchemy, none)sidentityi(soptparses OptionParsersversionsparsers add_optionsselfs templatessidentitys parse_argssoptionssargss__dict__supdatesnamesturbogearsversion(sselfsversionsargssparsersoptions((sMbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/quickstart.pys__init__]s&      cCsx|i otd|_qWxn|i ob|ii} tid| } tid| } td| |_|i o | |_q%q%Wt}xk| obtd}|i}| p |i dod|_ Pn|i doPndGHt}qWxb|i oVtd |_ |i o d |_ n|i d d gjod GHd|_ q q q Wt i |i|_t i}|ii|jo0d |iGx"||iD]}|GHdSqWndk}y+|i|iod|iGHdSnWntj onXtii|iod|iGHdSntid} g}x+|iidD]}|id|qoW|i|i|id|i|id|i |io|id|idn| i ||i oti!|id|i} tii| o-ti#| i$} ti&| | t#i'Bnddgt(_)dk}|i*d|iddgxbti+dD]M\}} }x;|D]3}|djo ti/tii0||qqWqWndS(sQuickstarts the new project.sEnter project name: ssEnter package name [%s]: sADo you need Identity (usernames/passwords) in this project? [no] snsnonesysPlease enter y(es) or n(o).s:Select your provider sqlobject or sqlalchemy [sqlobject]: s sqlobjects sqlalchemys-Please enter one of 'sqlobject', 'sqlalchemy's the name %s is already in use byNs%the package name %s is already in uses0A directory called '%s' already exists. Exiting.screates s --template=%ss package=%ss identity=%ss --simulates-qs start-%s.pyssetup.pysegg_infossetups.s./sempty(1sselfsnames raw_inputspackageslowersbeginning_letterssubs valid_onlysNones doidentitys startswithsidentitys pkg_resourcess safe_names Environmentsenvsdistsimps find_modules ImportErrorsosspathsexistss create_distrosCreateDistroCommandscommandscmd_argss templatesssplitstemplatesappendsdry_runsrunschdirs startscriptsstatsst_modesoldmodeschmodsS_IXUSRssyssargvs load_moduleswalksbasesfilessfilesremovesjoin(sselfsdistsfilescmd_argssimpstemplatesfilessenvsbasespaths startscriptspackagesoldmodescommands doidentity((sMbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/quickstart.pysrunus                           ( s__name__s __module__s__doc__sdescsNonesnamespackages templatessidentitys__init__srun(((sMbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/quickstart.pys quickstartSs  supdatecBs8tZdZdZeZdZeZdZdZ RS(sImplementation of updates%Update an existing turbogears projects turbogearsc Cstidddd|}|iddddd d d |i|id d ddd dd |i|i\}}|i i |i ||_ dS(Nsusages%prog quickstart [options]sversions%prog s-ts --templatesshelpsuser specific templatessdests templatessdefaults-is --identitys@identity provider to use (sqlobject (default), sqlalchemy, none)sidentity(soptparses OptionParsersversionsparsers add_optionsselfs templatessidentitys parse_argssoptionssargss__dict__supdatesturbogearsversion(sselfsversionsargssparsersoptions((sMbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/quickstart.pys__init__s  c Cs$tii|_tii|_|i otii dd|_nt i i t i }||ij od||ifGHdSn|i o dGHdSn{tid}g}|idx+|iidD]} |id | qW|i|i|id |i|id |i|i|d |i} t i i| o-t i| i}t i| |tiBnd dgt_ dk!}|i"d|i#ddgx^t i$dD]M\}} }x;|D]3}|djo t i(t i i)||qqWqWdS(sUpdates an existing projectsidentity.providersnonesNit looks like your project dir "%s" is named wrongly. Please rename it to "%s"Ns-this don't look like a turbogears project dirscreates-o../s s --template=%ss package=%ss identity=%ss start-%s.pyssetup.pysegg_infossetups.s./sempty(*s turbogearssutilsget_project_namesselfsnamesget_package_namespackagesidentitysconfigsgetsosspathsbasenamesgetcwds currentdirs create_distrosCreateDistroCommandscommandscmd_argssappends templatesssplitstemplatesruns startscriptsexistssstatsst_modesoldmodeschmodsS_IXUSRssyssargvsimps load_modules find_moduleswalksbasesfilessfilesremovesjoin( sselfsfiless currentdirsimpscmd_argssfilesoldmodesbasescommandstemplates startscriptspath((sMbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/quickstart.pysrunsJ         ( s__name__s __module__s__doc__sdescsNonesnames templatessidentitys__init__srun(((sMbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/quickstart.pysupdates  (s__doc__s pkg_resourcessresossos.pathsshutilsstatsoptparsessyss turbogearss paste.scripts templatess create_distroscompilesbeginning_letters valid_onlysTemplates TGTemplates BaseTemplatesTurbogearsTemplatesTGBigsTGWidgetTemplates quickstartsupdate(s templatessbeginning_lettersstats BaseTemplates turbogearss TGTemplatesoptparses valid_onlys pkg_resourcessupdatessyssresTGBigsTGWidgetTemplates create_distrosTurbogearsTemplatesshutilsoss quickstart((sMbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/command/quickstart.pys?s&          zPK54QFFturbogears/feed/__init__.pyfrom turbogears.feed import feed FeedController = feed.FeedController PK:4.y  turbogears/feed/__init__.pyc; RDc@sdklZeiZdS((sfeedN(sturbogears.feedsfeedsFeedController(sfeedsFeedController((sHbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/feed/__init__.pys?s PK;4 (turbogears/feed/atom0_3.kid id myfeed modified name email uri copyright tagline title id modified issued name email uri content summary copyright PK;48zturbogears/feed/atom1_0.kid id myfeed updated name icon logo rights subtitle title id updated published name content summary rights PK549llturbogears/feed/feed.pyimport time import cherrypy import turbogears class FeedController(turbogears.controllers.RootController): """ Object for generating feeds in multiple formats """ def __init__(self, default="atom1.0"): self.default = default self.formats = ["atom1.0", "atom0.3", "rss2.0"] def date_to_3339(self, date): date = date.strftime("%Y-%m-%dT%H:%M:%SZ") return date def date_to_822(self, date): date = date.strftime("%a, %d %b %Y %H:%M:%S GMT") return date def format_dates(self, feed, format): if format == 822: convert_date = self.date_to_822 else: convert_date = self.date_to_3339 if feed.has_key('updated'): feed["updated"] = convert_date(feed["updated"]) for entry in feed['entrys']: if entry.has_key('updated'): entry["updated"] = convert_date(entry["updated"]) if entry.has_key('published'): entry["published"] = convert_date(entry["published"]) return feed def index(self): raise cherrypy.HTTPRedirect(turbogears.url("/%s" % self.default)) index = turbogears.expose()(index) def atom1_0(self, **kwargs): feed = self.get_feed_data(**kwargs) self.format_dates(feed, 3339) feed["href"] = turbogears.url("/") + "atom1.0" return feed atom1_0 = turbogears.expose(template="turbogears.feed.atom1_0", format="xml", content_type="application/atom+xml")(atom1_0) def atom0_3(self, **kwargs): feed = self.get_feed_data(**kwargs) self.format_dates(feed, 3339) feed["href"] = turbogears.url("/") + "atom0.3" return feed atom0_3 = turbogears.expose(template="turbogears.feed.atom0_3", format="xml", content_type="application/atom+xml")(atom0_3) def rss2_0(self, **kwargs): feed = self.get_feed_data(**kwargs) self.format_dates(feed, 822) return feed rss2_0 = turbogears.expose(template="turbogears.feed.rss2_0", format="xml", content_type="application/rss+xml")(rss2_0) PK:4..turbogears/feed/feed.pyc; RDc@s;dkZdkZdkZdeiifdYZdS(NsFeedControllercBstZdZddZdZdZdZdZei eZdZ ei dd d d d d e Z dZ ei ddd d d d e Z dZ ei ddd d d de Z RS(s1 Object for generating feeds in multiple formats satom1.0cCs||_dddg|_dS(Nsatom1.0satom0.3srss2.0(sdefaultsselfsformats(sselfsdefault((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/feed/feed.pys__init__ s cCs|id}|SdS(Ns%Y-%m-%dT%H:%M:%SZ(sdatesstrftime(sselfsdate((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/feed/feed.pys date_to_3339scCs|id}|SdS(Ns%a, %d %b %Y %H:%M:%S GMT(sdatesstrftime(sselfsdate((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/feed/feed.pys date_to_822scCs|djo |i}n |i}|ido||d|d|i|}|i|dtidd|d<|SdS(Ni s/satom1.0shref(sselfs get_feed_dataskwargssfeeds format_datess turbogearssurl(sselfskwargssfeed((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/feed/feed.pysatom1_0)sstemplatesturbogears.feed.atom1_0sformatsxmls content_typesapplication/atom+xmlcKs>|i|}|i|dtidd|d<|SdS(Ni s/satom0.3shref(sselfs get_feed_dataskwargssfeeds format_datess turbogearssurl(sselfskwargssfeed((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/feed/feed.pysatom0_31ssturbogears.feed.atom0_3cKs'|i|}|i|d|SdS(Ni6(sselfs get_feed_dataskwargssfeeds format_dates(sselfskwargssfeed((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/feed/feed.pysrss2_09ssturbogears.feed.rss2_0sapplication/rss+xml( s__name__s __module__s__doc__s__init__s date_to_3339s date_to_822s format_datessindexs turbogearssexposesatom1_0satom0_3srss2_0(((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/feed/feed.pysFeedControllers            (stimescherrypys turbogearss controllerssRootControllersFeedController(sFeedControllers turbogearsscherrypystime((sDbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/feed/feed.pys?s   PK;4turbogears/feed/rss2_0.kid myfeed link description lastBuildDate lang generated title guid link pubDate description PK54g~~turbogears/i18n/__init__.py""" TurboGears internationalization/localization module. """ from turbogears.i18n.tg_gettext import gettext, ngettext, install, is_locale_supported, \ lazy_gettext, lazy_ngettext, plain_gettext from turbogears.i18n.utils import get_locale, get_accept_languages, set_session_locale, \ google_translate from turbogears.i18n.format import get_countries, get_country, get_month_names, \ get_abbr_month_names, get_weekday_names, get_abbr_weekday_names, \ get_languages, format_date, format_number, format_decimal, format_currency, \ parse_number, parse_decimal from turbogears.i18n.kidutils import translate, i18n_filter PK:4turbogears/i18n/__init__.pyc; RDc@sdZdklZlZlZlZlZlZlZdk l Z l Z l Z l Z dklZlZlZlZlZlZlZlZlZlZlZlZlZdklZlZdS(s7 TurboGears internationalization/localization module. (sgettextsngettextsinstallsis_locale_supporteds lazy_gettexts lazy_ngettexts plain_gettext(s get_localesget_accept_languagessset_session_localesgoogle_translate( s get_countriess get_countrysget_month_namessget_abbr_month_namessget_weekday_namessget_abbr_weekday_namess get_languagess format_dates format_numbersformat_decimalsformat_currencys parse_numbers parse_decimal(s translates i18n_filterN(s__doc__sturbogears.i18n.tg_gettextsgettextsngettextsinstallsis_locale_supporteds lazy_gettexts lazy_ngettexts plain_gettextsturbogears.i18n.utilss get_localesget_accept_languagessset_session_localesgoogle_translatesturbogears.i18n.formats get_countriess get_countrysget_month_namessget_abbr_month_namessget_weekday_namessget_abbr_weekday_namess get_languagess format_dates format_numbersformat_decimalsformat_currencys parse_numbers parse_decimalsturbogears.i18n.kidutilss translates i18n_filter(s parse_decimalsget_month_namessget_weekday_namessget_accept_languagess get_countriess get_languagessformat_currencysgettexts plain_gettextsgoogle_translates translates lazy_gettexts get_locales lazy_ngettextsget_abbr_month_namess format_numbersset_session_localesngettexts get_countrysis_locale_supporteds format_dates parse_numbers i18n_filtersget_abbr_weekday_namessinstallsformat_decimal((sHbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/__init__.pys?s1UPK64T7 turbogears/i18n/format.py""" Localized formatting functions. These functions extract localization data from config files located in the data/directory. """ from turbogears.i18n.utils import get_locale import pkg_resources import os import re def is_locale_format(locale): py_filename = pkg_resources.resource_filename("turbogears.i18n.data", "%s.py" %locale) if os.path.exists(py_filename):return True pyc_filename = pkg_resources.resource_filename("turbogears.i18n.data", "%s.pyc" %locale) if os.path.exists(pyc_filename):return True return False def get_locale_module(locale): try: # check if locale is supported. If not, check again with first part of locale # for example, "fi_FI" > "fi". if not is_locale_format(locale): locale = locale[:2] name = "turbogears.i18n.data.%s" %locale mod = __import__(name) parts = name.split(".")[1:] for p in parts:mod = getattr(mod, p) return mod except (ImportError, AttributeError): return None def get(locale, name, default=None): locale = get_locale(locale) mod = get_locale_module(locale) return getattr(mod, name, default) def get_countries(locale=None): """ Returns list of tuples, consisting of international country code and localized name, e.g. ('AU', 'Australia') """ countries = get(locale, "countries", {}).items() countries.sort(lambda x,y:cmp(x[1], y[1])) return countries def get_country(key, locale=None): """ Returns localized name of country based on international country code """ return get(locale, "countries", {})[key] def get_languages(locale=None): """Returns list of tuples, with language code and localized name, e.g. ('en', 'English') """ languages = get(locale, "languages", {}).items() languages.sort(lambda x,y:cmp(x[1], y[1])) return languages def get_language(key, locale=None): """ Returns localized name of language based on language code """ return get(locale, "languages", {})[key] def get_month_names(locale=None): """Returns list of full month names, starting with January """ return get(locale, "months", []) def get_abbr_month_names(locale=None): """Returns list of abbreviated month names, starting with Jan """ return get(locale, "abbrMonths", []) def get_weekday_names(locale=None): """Returns list of full weekday names """ return get(locale, "days", []) def get_abbr_weekday_names(locale=None): """Returns list of abbreviated weekday names """ return get(locale, "abbrDays", get_weekday_names(locale)) def get_decimal_format(locale=None): return get(locale, "numericSymbols").get("decimal", ".") def get_group_format(locale=None): return get(locale, "numericSymbols").get("group", ",") def format_number(value, locale=None): """ Returns number formatted with grouping for thousands, e.g. 5000000>5,000,000 """ gf = get_group_format(locale) thou=re.compile(r"([0-9])([0-9][0-9][0-9]([%s]|$))" %gf).search v=str(value) mo=thou(v) while mo is not None: l = mo.start(0) v=v[:l+1]+gf+v[l+1:] mo=thou(v) return unicode(v) def format_decimal(value, num_places, locale=None): """ Returns number formatted with grouping for thousands and correct notation, e.g. 5000000.898>5,000,000.898 """ format = "%%.%df"%num_places str = format%value num, decimals = str.split(".") return unicode(format_number(num, locale) + get_decimal_format(locale) + decimals) def format_currency(value, locale=None): """ Returns formatted currency value """ return format_decimal(value, 2, locale) def parse_number(value, locale=None): """ Takes localized number string and returns a long integer (or throws ValueError if bad format) """ return long(value.replace(get_group_format(locale), "")) def parse_decimal(value, locale=None): """ Takes localized decimal string and returns a float (or throws ValueError if bad format) """ value = value.replace(get_group_format(locale), "") value = value.replace(get_decimal_format(locale), ".") return float(value) def get_date_format(format, locale=None): formats = get(locale, "dateFormats", {}) return formats.get(format, None) def format_date(dt, format="medium", locale=None, time_format=""): """Returns formatted date value. Format can be "full", "long", "medium" or "short". @param dt: datetime @type dt: datetime.datetime @param format: format("full", "long", "medium", "short") @type format:string @param locale @param time_format: standard time formatting string, e.g. H:M @type time_format:string """ pattern = get_date_format(format, locale) if not pattern:return str(dt) month = dt.month-1 weekday = dt.weekday() # becase strftime() accepts str only but not unicode # we encode string to utf-8 and then decode back date_str = dt.strftime(pattern.encode('utf8')+time_format) return date_str.decode('utf8') % { 'monthname':get_month_names(locale)[month], 'abbrmonthname':get_abbr_month_names(locale)[month], 'dayname':get_weekday_names(locale)[weekday], 'abbrdayname':get_abbr_weekday_names(locale)[weekday], } PK:4ܽ''turbogears/i18n/format.pyc; RDc@s"dZdklZdkZdkZdkZdZdZedZ edZ edZ edZ ed Z ed Zed Zed Zed ZedZedZedZedZedZedZedZedZdeddZdS(s Localized formatting functions. These functions extract localization data from config files located in the data/directory. (s get_localeNcCsjtidd|}tii|otSntidd|}tii|otSnt SdS(Nsturbogears.i18n.datas%s.pys%s.pyc( s pkg_resourcessresource_filenameslocales py_filenamesosspathsexistssTrues pyc_filenamesFalse(slocales py_filenames pyc_filename((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysis_locale_format scCsymt| o|d }nd|}t|}|idd}x|D]}t||}qOW|SWnt t fj o t SnXdS(Nisturbogears.i18n.data.%ss.i( sis_locale_formatslocalesnames __import__smodssplitspartsspsgetattrs ImportErrorsAttributeErrorsNone(slocalesnamespspartssmod((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysget_locale_modules  cCs,t|}t|}t|||SdS(N(s get_localeslocalesget_locale_modulesmodsgetattrsnamesdefault(slocalesnamesdefaultsmod((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysget)s  cCs0t|dhi}|id|SdS(s| Returns list of tuples, consisting of international country code and localized name, e.g. ('AU', 'Australia') s countriescCst|d|dS(Ni(scmpsxsy(sxsy((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pys7sN(sgetslocalesitemss countriesssort(slocales countries((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pys get_countries0scCst|dh|SdS(sO Returns localized name of country based on international country code s countriesN(sgetslocaleskey(skeyslocale((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pys get_country:scCs0t|dhi}|id|SdS(sZReturns list of tuples, with language code and localized name, e.g. ('en', 'English') s languagescCst|d|dS(Ni(scmpsxsy(sxsy((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysFsN(sgetslocalesitemss languagesssort(slocales languages((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pys get_languagesAscCst|dh|SdS(sC Returns localized name of language based on language code s languagesN(sgetslocaleskey(skeyslocale((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pys get_languageIscCst|dgSdS(s<Returns list of full month names, starting with January smonthsN(sgetslocale(slocale((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysget_month_namesPscCst|dgSdS(s?Returns list of abbreviated month names, starting with Jan s abbrMonthsN(sgetslocale(slocale((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysget_abbr_month_namesUscCst|dgSdS(s'Returns list of full weekday names sdaysN(sgetslocale(slocale((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysget_weekday_names[scCst|dt|SdS(s.Returns list of abbreviated weekday names sabbrDaysN(sgetslocalesget_weekday_names(slocale((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysget_abbr_weekday_namesascCst|diddSdS(NsnumericSymbolssdecimals.(sgetslocale(slocale((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysget_decimal_formatgscCst|diddSdS(NsnumericSymbolssgroups,(sgetslocale(slocale((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysget_group_formatkscCst|}tid|i}t|}||}xK|t j o=|i d}||d |||d}||}q=Wt|SdS(sV Returns number formatted with grouping for thousands, e.g. 5000000>5,000,000 s ([0-9])([0-9][0-9][0-9]([%s]|$))iiN(sget_group_formatslocalesgfsrescompilessearchsthousstrsvaluesvsmosNonesstartslsunicode(svalueslocalesmoslsgfsvsthou((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pys format_numberps    cCsNd|}||}|id\}}tt||t ||SdS(sx Returns number formatted with grouping for thousands and correct notation, e.g. 5000000.898>5,000,000.898 s%%.%dfs.N( s num_placessformatsvaluesstrssplitsnumsdecimalssunicodes format_numberslocalesget_decimal_format(svalues num_placesslocalesformatsnumsstrsdecimals((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysformat_decimals   cCst|d|SdS(s* Returns formatted currency value iN(sformat_decimalsvalueslocale(svalueslocale((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysformat_currencyscCs t|it|dSdS(sh Takes localized number string and returns a long integer (or throws ValueError if bad format) sN(slongsvaluesreplacesget_group_formatslocale(svalueslocale((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pys parse_numberscCs>|it|d}|it|d}t|SdS(sb Takes localized decimal string and returns a float (or throws ValueError if bad format) ss.N(svaluesreplacesget_group_formatslocalesget_decimal_formatsfloat(svalueslocale((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pys parse_decimalscCs&t|dh}|i|tSdS(Ns dateFormats(sgetslocalesformatssformatsNone(sformatslocalesformats((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pysget_date_formatssmediumscCst||}| ot|Sn|id}|i}|i|i d|}|i dhdt ||<dt||<dt||<dt||<SdS(sSReturns formatted date value. Format can be "full", "long", "medium" or "short". @param dt: datetime @type dt: datetime.datetime @param format: format("full", "long", "medium", "short") @type format:string @param locale @param time_format: standard time formatting string, e.g. H:M @type time_format:string isutf8s monthnames abbrmonthnamesdaynames abbrdaynameN(sget_date_formatsformatslocalespatternsstrsdtsmonthsweekdaysstrftimesencodes time_formatsdate_strsdecodesget_month_namessget_abbr_month_namessget_weekday_namessget_abbr_weekday_names(sdtsformatslocales time_formatspatternsmonthsweekdaysdate_str((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pys format_dates   (s__doc__sturbogears.i18n.utilss get_locales pkg_resourcessossresis_locale_formatsget_locale_modulesNonesgets get_countriess get_countrys get_languagess get_languagesget_month_namessget_abbr_month_namessget_weekday_namessget_abbr_weekday_namessget_decimal_formatsget_group_formats format_numbersformat_decimalsformat_currencys parse_numbers parse_decimalsget_date_formats format_date(s parse_decimals get_languagesget_month_namess pkg_resourcessget_weekday_namessget_group_formats get_countriess parse_numbersformat_currencysres get_localesget_decimal_formatsgetsget_abbr_month_namess format_numbersformat_decimals get_countrysis_locale_formats format_dates get_languagessget_date_formatsget_locale_modulesget_abbr_weekday_namessos((sFbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/format.pys?s0                   PK64~Wj6 6 turbogears/i18n/kidutils.py""" Functions for use with Kid template """ from kid.pull import START, TEXT, END import turbogears # use plain_gettext because Kid template's strings always evaluated immediately from turbogears.i18n.tg_gettext import plain_gettext as gettext from turbogears.i18n.utils import google_translate def translate(item, attr=None): """Translates the text of element plus the text of all child elements. If attr is present this is used to provide the locale name; if not then value provided by get_locale is used. For example:
this is a test testing
The string 'this is a test' is rendered by the locale provided by get_locale, the string 'testing' by the German locale. Possible use in Kid template:

Welcome!

@param item: element to be translated @type item: ElementTree element @param attr: attribute name used to store locale, if any """ if attr is None:attr = turbogears.config.get("i18n.templateLocaleAttribute", "lang") translate_all(item, item.get(attr), attr) return item def translate_all(tree, lang, attr): """Recursive function to translate all text in child elements @param tree: parent ElementTree element @param lang: language setting @param attr: attribute name used to store locale """ if tree.text: tree.text = gettext(tree.text.strip(), lang) for element in tree: # check overriding lang attribute if element.get(attr):lang = element.get(attr) translate_all(element, lang, attr) def i18n_filter(stream, template, locale=None): """Kid template filter which calls translates all elements matching language attribute(set in configuration as i18n.templateLocaleAttribute, default 'lang') """ lang_attr = turbogears.config.get("i18n.templateLocaleAttribute", "lang") locales=[locale] for ev, item in stream: if ev==START: l = item.get(lang_attr) if l: locale = l locales.append(l) elif ev==TEXT: prefix = '' postfix = '' if len(item) > 0 and item[0] == ' ': prefix =' ' if len(item) > 1 and item[-1] == ' ': postfix =' ' text = item.strip() if text: item = gettext(text, locale) item = prefix + item + postfix elif ev==END: if item.get(lang_attr): locales.pop() locale = locales[-1] yield (ev, item) PK:4R__turbogears/i18n/kidutils.pyc; RDc@sgdZdklZlZlZdkZdklZdk l Z e dZ dZ e dZdS(s% Functions for use with Kid template (sSTARTsTEXTsENDN(s plain_gettext(sgoogle_translatecCsG|tjotiidd}nt||i|||SdS(s8Translates the text of element plus the text of all child elements. If attr is present this is used to provide the locale name; if not then value provided by get_locale is used. For example:
this is a test testing
The string 'this is a test' is rendered by the locale provided by get_locale, the string 'testing' by the German locale. Possible use in Kid template:

Welcome!

@param item: element to be translated @type item: ElementTree element @param attr: attribute name used to store locale, if any si18n.templateLocaleAttributeslangN(sattrsNones turbogearssconfigsgets translate_allsitem(sitemsattr((sHbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/kidutils.pys translate s  cCsq|iot|ii||_nxA|D]9}|i|o|i|}nt|||q0WdS(sRecursive function to translate all text in child elements @param tree: parent ElementTree element @param lang: language setting @param attr: attribute name used to store locale N( streestextsgettextsstripslangselementsgetsattrs translate_all(streeslangsattrselement((sHbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/kidutils.pys translate_all's c csgtiidd}|g} xB|D]:\}}|t jo1|i|}|o|}| i |qUn|t jod}d} t|djo|ddjo d}nt|djo|ddjo d} n|i}|o!t||}||| }qUn:|tjo,|i|o| i| d}qUn||fVq%WdS( sKid template filter which calls translates all elements matching language attribute(set in configuration as i18n.templateLocaleAttribute, default 'lang') si18n.templateLocaleAttributeslangsis iiN(s turbogearssconfigsgets lang_attrslocaleslocalessstreamsevsitemsSTARTslsappendsTEXTsprefixspostfixslensstripstextsgettextsENDspop( sstreamstemplateslocalesevslsitemsprefixstexts lang_attrspostfixslocales((sHbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/kidutils.pys i18n_filter5s4    $ $    (s__doc__skid.pullsSTARTsTEXTsENDs turbogearssturbogears.i18n.tg_gettexts plain_gettextsgettextsturbogears.i18n.utilssgoogle_translatesNones translates translate_alls i18n_filter( sENDs turbogearss translate_allsTEXTs i18n_filtersgettextsSTARTsgoogle_translates translate((sHbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/kidutils.pys?s     PK64]i)turbogears/i18n/tg_gettext.pyfrom gettext import translation import turbogears from turbogears.i18n.utils import get_locale from turbojson.jsonify import jsonify from turbogears.util import request_available import os import types _catalogs = {} def is_locale_supported(locale, domain=None): """Checks if [domain].mo file exists for this language """ if not domain:domain = turbogears.config.get("i18n.domain", "messages") localedir = turbogears.config.get("i18n.localeDir", "locales") return os.path.exists(os.path.join(localedir, locale, "LC_MESSAGES", "%s.mo" %domain)) def get_catalog(locale, domain = None): """Return translations for given locale. """ if domain is None:domain = turbogears.config.get("i18n.domain", "messages") catalog = _catalogs.get(domain) if not catalog: catalog = _catalogs[domain] = {} messages = catalog.get(locale) if not messages: localedir = turbogears.config.get("i18n.localeDir", "locales") messages = catalog[locale] = translation(domain=domain, localedir=localedir, languages=[locale]) return messages def plain_gettext(key, locale=None, domain=None): """Gets the gettext value for key.Added to builtins as '_'. Returns Unicode string. @param key: text to be translated @param locale: locale code to be used.If locale is None, gets the value provided by get_locale. """ gettext_func = turbogears.config.get("i18n.gettext", tg_gettext) return gettext_func(key, locale, domain) def tg_gettext(key, locale=None, domain=None): """Gets the gettext value for key.Added to builtins as '_'. Returns Unicode string. @param key: text to be translated @param locale: locale code to be used.If locale is None, gets the value provided by get_locale. """ if locale is None:locale = get_locale() if not is_locale_supported(locale):locale = locale[:2] if key == '': return '' # special case try: return get_catalog(locale, domain).ugettext(key) except KeyError: return key except IOError: return key def plain_ngettext(key1, key2, num, locale=None): """Translates two possible texts based on whether num is greater than 1 @param key1: text if num==1 @param key2: text if num!=1 @param num: a number @type num: integer @locale:locale code to be used.If locale is None, gets the value provided by get_locale. """ if num==1: return plain_gettext(key1, locale) else: return plain_gettext(key2, locale) class lazystring(object): """Has a number of lazily evaluated functions replicating a string. Just override the eval() method to produce the actual value. """ def __init__(self, func, *args, **kw): self.func = func self.args = args self.kw = kw def eval(self): return self.func(*self.args, **self.kw) def __unicode__(self): return unicode(self.eval()) def __str__(self): return str(self.eval()) def __mod__(self, other): return self.eval() % other def lazify(func): def newfunc(*args, **kw): lazystr = lazystring(func, *args, **kw) return lazystr return newfunc def jsonify_lazystring(obj): return unicode(obj) jsonify.when("isinstance(obj, lazystring)")(jsonify_lazystring) lazy_gettext = lazify(plain_gettext) lazy_ngettext = lazify(plain_ngettext) def gettext(key, locale=None, domain=None): """Gets the gettext value for key. Added to builtins as '_'. Returns Unicode string. @param key: text to be translated @param locale: locale code to be used. If locale is None, gets the value provided by get_locale. """ if request_available(): return plain_gettext(key, locale, domain) else: return lazy_gettext(key, locale, domain) def ngettext(key1, key2, num, locale=None): """Translates two possible texts based on whether num is greater than 1. @param key1: text if num==1 @param key2: text if num!=1 @param num: a number @type num: integer @param locale: locale code to be used. If locale is None, gets the value provided by get_locale. """ if request_available(): return plain_ngettext(key1, key2, num, locale) else: return lazy_ngettext(key1, key2, num, locale) def install(): """Adds the gettext function to __builtins__ as '_' """ __builtins__["_"] = gettext PK:4K  turbogears/i18n/tg_gettext.pyc; RDc@sdklZdkZdklZdklZdklZdk Z dk Z hZ e dZ e dZe e dZe e dZe d Zd efd YZd Zd ZeideeeZeeZe e dZe dZdZdS((s translationN(s get_locale(sjsonify(srequest_availablecCsc| otiidd}ntiidd}tiitii||dd|SdS(s8Checks if [domain].mo file exists for this language s i18n.domainsmessagessi18n.localeDirslocaless LC_MESSAGESs%s.moN( sdomains turbogearssconfigsgets localedirsosspathsexistssjoinslocale(slocalesdomains localedir((sJbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/tg_gettext.pysis_locale_supported s cCs|tjotiidd}nti|}| oh}t|(.*?)', re.DOTALL).search(s) data = match.groups()[0] return unicode(data, "utf-8").strip() def lang_in_gettext_format(lang): if len(lang) > 2: country = lang[3:].upper() lang = lang[:2] + "_" + country return lang def get_accept_languages(accept): """Returns a list of languages, by order of preference, based on an HTTP Accept-Language string.See W3C RFC 2616 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) for specification. """ langs = parse_http_accept_header(accept) for index, lang in enumerate(langs): langs[index] = lang_in_gettext_format(lang) return langs def get_locale(locale=None): """Returns user locale, using _get_locale or app-specific locale lookup function """ if not locale: get_locale_f = config.get("i18n.getLocale", _get_locale) locale = get_locale_f() return locale def _get_locale(): """Default function for returning locale. First looks in session for locale key, then checks the HTTP Accept-Language header, and finally checks the config default locale setting. This can be replaced by your own function by setting cherrypy config setting i18n.getLocale to your function name. """ if config.get("session_filter.on", False): locale_key = config.get("i18n.sessionKey", "locale") locale = cherrypy.session.get(locale_key) if locale:return locale # check HTTP Accept-Language header # we get a list of preferred languages, check if each is supported try: accept_languages= get_accept_languages(cherrypy.request.headers.get("Accept-Language")) if accept_languages : return accept_languages[0] except AttributeError: pass # check config setting return config.get("i18n.defaultLocale", "en") def set_session_locale(locale): """ Sets the i18n session locale """ cherrypy.session[config.get("i18n.sessionKey", "locale")] = locale PK:4+4turbogears/i18n/utils.pyc; RDc@sdZdkZdkZdkZdkZdkZdklZdkl Z dZ dZ dZ e dZdZd ZdS( s General i18n utility functions N(sconfig(sparse_http_accept_headerc Cstihdd||f<d|<dd<dd<}tid}|i dd ||i }|i }|itid tii|}|id }t|d iSdS( Nslangpairs%s|%sstextsiesUTF8soestranslate.google.comsPOSTs /translate_ts$isutf-8(surllibs urlencodes from_langsto_langstextsparamsshttplibsHTTPConnectionsconnsrequests getresponsesrespsreadsssclosesrescompilesDOTALLssearchsmatchsgroupssdatasunicodesstrip( s from_langsto_langstextsrespsssparamssmatchsdatasconn((sEbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/utils.pysgoogle_translate s=    cCsAt|djo&|di}|d d|}n|SdS(Niis_(slenslangsupperscountry(slangscountry((sEbuild/bdist.darwin-8.6.0-Power_Macintosh/egg/turbogears/i18n/utils.pyslang_in_gettext_formatscCsAt|}x*t|D]\}}t|||<d?d@<dAdB<dCdD<dEdF<dGdH<d?d@<dAdB<dCdD<dEdF<dGdHd?<d@dA<dBdC<dDdE<dFdG<dHdI<dJdK<dLdM<dNdO<dPdQ<dRdS<dTdU<dVdW<dXdY<dZd[<d\d]<d^d_<d`da<dbdc<ddde<dfdg<dhdi<djdk<dldm<dndo<dpdq<drds<dtdu<dvdw<dxdy<dzd{<d|d}<d~d<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd <d d <d d <dd<dd<dd<dd<dd<dd<ddd?<d@dA<dBdC<dDdE<dFdG<dHdI<dJdK<dLdM<dNdO<dPdQ<dRdS<dTdU<dVdW<dXdY<dZd[<d\d]<d^d_<d`da<dbdc<ddde<dfdg<dhdi<djdk<dldm<dndo<dpdq<drds<dtdu<dvdw<dxdy<dzd{<d|d}<d~d<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd/<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<d d <d d <d d<dd<dd<dd<dd<dd<dd<dd<dd<d?d@<dAdBd?<d@dA<dBdC<dDdE<dFdG<dHdI<dJdK<dLdM<dNdO<dPdQ<dRdS<dTdU<dVdW<dXdY<dZd[<d\d]<d^d_<d`da<dbdc<ddde<dfdg<dhdi<djdk<dldm<dndo<dpdq<drds<dtdu<dvdw<dxdy<dzd{<d|d}<d~d<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd <d d <d d <dd<dd<dd<dd<dd<dd<ddd?<d@dA<dBdC<dDdE<dFdG<dHdI<dJdK<dL