Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More refactoring for #66

  • Loading branch information...
commit cad21a35ed6367eaa557d081d0506f57ccf590e7 1 parent b3d862b
Paul Kinlan authored
Showing with 64 additions and 109 deletions.
  1. +0 −1  server/.idea/.name
  2. +0 −5 server/.idea/encodings.xml
  3. +0 −8 server/.idea/misc.xml
  4. +0 −9 server/.idea/modules.xml
  5. +0 −19 server/.idea/server.iml
  6. +0 −7 server/.idea/vcs.xml
  7. +9 −9 server/.idea/workspace.xml
  8. +1 −1  server/demos/imagestudio/pages/index.html
  9. +1 −1  server/demos/imgur/pages/index.html
  10. +1 −1  server/demos/instapaper/pages/index.html
  11. +1 −1  server/demos/mememator/pages/index.html
  12. +1 −1  server/demos/pages/twitter/index.html
  13. +1 −1  server/demos/shortener/pages/index.html
  14. +1 −1  server/demos/twitpic/pages/index.html
  15. +1 −1  server/examples/pages/index.html
  16. +1 −1  server/examples/pages/intents/discover/discover.html
  17. +1 −1  server/examples/pages/intents/discover/discover_action.html
  18. +1 −1  server/examples/pages/intents/discover/discover_discover.html
  19. +1 −1  server/examples/pages/intents/pick/pick.html
  20. +1 −1  server/examples/pages/intents/pick/pick_action.html
  21. +1 −1  server/examples/pages/intents/pick/pick_pick.html
  22. +1 −1  server/examples/pages/intents/share/share.html
  23. +1 −1  server/examples/pages/intents/share/share_action.html
  24. +1 −1  server/examples/pages/intents/share/share_image.html
  25. +1 −1  server/examples/pages/intents/share/share_link.html
  26. +1 −1  server/examples/pages/intents/shorten/shorten.html
  27. +1 −1  server/examples/pages/intents/shorten/shorten_action.html
  28. 0  server/examples/pages/usage/{declarativeRegister → declarativeRegistration}/index.html
  29. +1 −1  server/examples/pages/usage/startActivity/index.html
  30. +6 −5 server/handlers_base.py
  31. +1 −1  server/registry/pages/index.html
  32. +15 −12 server/server.py
  33. +1 −1  server/webintents/pages/discover
  34. +1 −1  server/webintents/pages/edit
  35. +1 −1  server/webintents/pages/faq.html
  36. +1 −1  server/webintents/pages/index.html
  37. +1 −1  server/webintents/pages/pick
  38. +1 −1  server/webintents/pages/save
  39. +1 −1  server/webintents/pages/share
  40. +1 −1  server/webintents/pages/subscribe
  41. +1 −1  server/webintents/pages/view
  42. +1 −1  server/widgets/pages/index.html
  43. +1 −1  server/widgets/pages/save.html
  44. +1 −1  server/widgets/pages/share.html
View
1  server/.idea/.name
@@ -1 +0,0 @@
-server
View
5 server/.idea/encodings.xml
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
-</project>
-
View
8 server/.idea/misc.xml
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="DependencyValidationManager">
- <option name="SKIP_IMPORT_STATEMENTS" value="false" />
- </component>
- <component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7.2 (/Library/Frameworks/Python.framework/Versions/2.7/bin/python)" project-jdk-type="Python SDK" />
-</project>
-
View
9 server/.idea/modules.xml
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="ProjectModuleManager">
- <modules>
- <module fileurl="file://$PROJECT_DIR$/.idea/server.iml" filepath="$PROJECT_DIR$/.idea/server.iml" />
- </modules>
- </component>
-</project>
-
View
19 server/.idea/server.iml
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="PYTHON_MODULE" version="4">
- <component name="FacetManager">
- <facet type="google-appengine-python" name="Google App Engine (Python)">
- <configuration>
- <option name="rootFolder" value="$MODULE_DIR$" />
- <option name="sdkFolder" value="/usr/local/google_appengine" />
- <option name="templatesFolder" value="" />
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager">
- <content url="file://$MODULE_DIR$" />
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" name="Google App Engine SDK" level="project" />
- </component>
-</module>
-
View
7 server/.idea/vcs.xml
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="VcsDirectoryMappings">
- <mapping directory="" vcs="" />
- </component>
-</project>
-
View
18 server/.idea/workspace.xml
@@ -23,10 +23,10 @@
</component>
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="handlers_base.py" pinned="false" current="false" current-in-tab="false">
+ <file leaf-file-name="handlers_base.py" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/handlers_base.py">
<provider selected="true" editor-type-id="text-editor">
- <state line="51" column="0" selection-start="1465" selection-end="1465" vertical-scroll-proportion="0.0">
+ <state line="51" column="0" selection-start="1465" selection-end="1465" vertical-scroll-proportion="0.54332554">
<folding />
</state>
</provider>
@@ -50,10 +50,10 @@
</provider>
</entry>
</file>
- <file leaf-file-name="loaders.py" pinned="false" current="true" current-in-tab="true">
+ <file leaf-file-name="loaders.py" pinned="false" current="false" current-in-tab="false">
<entry file="file:///Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Jinja2-2.6-py2.7.egg/jinja2/loaders.py">
<provider selected="true" editor-type-id="text-editor">
- <state line="161" column="0" selection-start="6191" selection-end="6191" vertical-scroll-proportion="0.3325527">
+ <state line="161" column="0" selection-start="6191" selection-end="6191" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
@@ -209,7 +209,7 @@
</component>
<component name="ToolWindowManager">
<frame x="0" y="22" width="1387" height="878" extended-state="6" />
- <editor active="true" />
+ <editor active="false" />
<layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32894737" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
@@ -296,16 +296,16 @@
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/handlers_base.py">
+ <entry file="file:///Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Jinja2-2.6-py2.7.egg/jinja2/loaders.py">
<provider selected="true" editor-type-id="text-editor">
- <state line="51" column="0" selection-start="1465" selection-end="1465" vertical-scroll-proportion="0.0">
+ <state line="161" column="0" selection-start="6191" selection-end="6191" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file:///Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Jinja2-2.6-py2.7.egg/jinja2/loaders.py">
+ <entry file="file://$PROJECT_DIR$/handlers_base.py">
<provider selected="true" editor-type-id="text-editor">
- <state line="161" column="0" selection-start="6191" selection-end="6191" vertical-scroll-proportion="0.3325527">
+ <state line="51" column="0" selection-start="1465" selection-end="1465" vertical-scroll-proportion="0.54332554">
<folding />
</state>
</provider>
View
2  server/demos/imagestudio/pages/index.html
@@ -1,4 +1,4 @@
-{% extends "layouts/application.html" %}
+{% extends "demos/imagestudio/layouts/application.html" %}
{% block title %}Image Studio{% endblock %}
{% block scripts %}
<script src="//webintents.org/webintents.min.js"></script>
View
2  server/demos/imgur/pages/index.html
@@ -1,4 +1,4 @@
-{% extends "layouts/application.html" %}
+{% extends "demos/imgur/layouts/application.html" %}
{% block title %}Demo: Imgur{% endblock%}
{% block head %}Demo: Imgur{% endblock%}
{% block scripts %}
View
2  server/demos/instapaper/pages/index.html
@@ -1,4 +1,4 @@
-{% extends "layouts/application.html" %}
+{% extends "demos/instapaper/layouts/application.html" %}
{% block title %}Demo: Instapaper{% endblock%}
{% block head %}Demo: Instapaper{% endblock%}
{% block scripts %}
View
2  server/demos/mememator/pages/index.html
@@ -1,4 +1,4 @@
-{% extends "layouts/application.html" %}
+{% extends "demos/mememator/layouts/application.html" %}
{% block scripts %}
<script src="//webintents.org/webintents.min.js"></script>
<link rel=icon href="favicon.ico" />
View
2  server/demos/pages/twitter/index.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "demos/layouts/base.html" %}
{% block title %}Web Intents: Twitter Demo{% endblock %}
{% block headline %}Web Intents: Twitter Demos{% endblock %}
{% block scripts %}
View
2  server/demos/shortener/pages/index.html
@@ -1,4 +1,4 @@
-{% extends "layouts/application.html" %}
+{% extends "demos/shortener/layouts/application.html" %}
{% block title %}Demo: Goo.gl URL Shortener{% endblock%}
{% block head %}Demo: Goo.gl URL Shortener{% endblock%}
{% block scripts %}
View
2  server/demos/twitpic/pages/index.html
@@ -1,4 +1,4 @@
-{% extends "layouts/application.html" %}
+{% extends "demos/twitpic/layouts/application.html" %}
{% block scripts %}
<link rel=icon href="favicon.ico" />
<intent action="http://webintents.org/save"
View
2  server/examples/pages/index.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block title %}Examples{% endblock %}
{% block headline %}Examples{% endblock %}
{% block head %}
View
2  server/examples/pages/intents/discover/discover.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block title %}Intent: Discover{% endblock %}
{% block headline %}Discover Intent Example{% endblock %}
{% block head %}
View
2  server/examples/pages/intents/discover/discover_action.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block title %}Intent: Discover{% endblock %}
{% block scripts %}
<script src="//webintents.org/webintents.min.js"></script>
View
2  server/examples/pages/intents/discover/discover_discover.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block title %}Discovery{% endblock %}
{% block scripts %}
<script src="//webintents.org/webintents.min.js"></script>
View
2  server/examples/pages/intents/pick/pick.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block headline %}Pick intent example{% endblock %}
{% block title %}Intent: Pick{% endblock %}
{% block scripts %}
View
2  server/examples/pages/intents/pick/pick_action.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block title %}Intent: Pick{% endblock %}
{% block scripts %}
<script src="//webintents.org/webintents.min.js"></script>
View
2  server/examples/pages/intents/pick/pick_pick.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block title %}Pick an Image{% endblock %}
{% block scripts %}
<script src="//webintents.org/webintents.min.js"></script>
View
2  server/examples/pages/intents/share/share.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block title %}Intent: Share{% endblock %}
{% block headline %}Share intent examples{% endblock %}
{% block scripts %}
View
2  server/examples/pages/intents/share/share_action.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% content scripts %}
<script src="//webintents.org/webintents.min.js"></script>
<script src="/javascripts/events.js"></script>
View
2  server/examples/pages/intents/share/share_image.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block title %}Share Image{% endblock %}
{% block headline %}Image Sharing app{% endblock %}
View
2  server/examples/pages/intents/share/share_link.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block title %}Share Link{% endblock %}
{% block headline %}Link Sharing app{% endblock %}
{% block head %}
View
2  server/examples/pages/intents/shorten/shorten.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block title %}Intent: Shorten{% endblock %}
{% block headline %}Shorten Intent Example{% endblock %}
{% block head %}
View
2  server/examples/pages/intents/shorten/shorten_action.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block title %}Kinlan's Link Shortener{% endblock %}
{% block headline %}Kinlan's Link Shortener{% endblock %}
{% block scripts %}
View
0  ...ages/usage/declarativeRegister/index.html → .../usage/declarativeRegistration/index.html
File renamed without changes
View
2  server/examples/pages/usage/startActivity/index.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "examples/layouts/base.html" %}
{% block title %}Example: startActivity{% endblock %}
{% block headline %}Example: startActivity{% endblock %}
{% block scripts %}
View
11 server/handlers_base.py
@@ -25,7 +25,6 @@ class PageHandler(webapp2.RequestHandler):
def render_file(self, file, domain):
import logging
self.response.headers['X-Content-Security-Policy'] = "allow 'self'; img-src *; script-src www.google-analytics.com apis.google.com;"
- request_path = os.path.dirname(self.request.path[1:]) # Slice off the leading slash
if file is None or file == "":
file = "index.html"
@@ -41,15 +40,17 @@ def render_file(self, file, domain):
self.response.headers['Content-Type'] = content_type
# test if the file exists in the static
- path = os.path.join(domain, request_path , "static", file)
+ path = os.path.join(os.path.dirname(__file__), domain, "static", file)
if os.path.exists(path):
f = open(path, "r")
self.response.out.write(f.read())
return
-
- path = os.path.join(domain, request_path, "pages", file)
+
+ template_path = os.path.join(domain, "pages", file)
+ logging.info(template_path)
+ path = os.path.join(os.path.dirname(__file__), template_path)
if os.path.exists(path):
- template = jinja_environment.get_template(path)
+ template = jinja_environment.get_template(template_path)
self.response.out.write(template.render())
else:
self.error(404)
View
2  server/registry/pages/index.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "registry/layouts/base.html" %}
{% block title %}Web Intents: Index{% endblock %}
{% block headline %}Web Intents: Index{% endblock %}
{% block head %}
View
27 server/server.py
@@ -18,18 +18,18 @@
exampleRoutes = [ Route('/<:.*>', handlers_base.PageHandler, 'examples')]
demoRoutes = [
- Route('/mememator/proxy', demos.mememator.handlers.ProxyHandler, 'demos'),
- Route('/mememator/<:.*>', handlers_base.PageHandler, 'demos'),
- Route('/imagestudio/<:.*>', handlers_base.PageHandler, 'demos'),
- Route('/twitpic/proxy', demos.twitpic.handlers.ProxyHandler, 'demos'),
- Route('/twitpic/upload', demos.twitpic.handlers.UploadHandler, 'demos'),
- Route('/twitpic/<:.*>', handlers_base.PageHandler, 'demos'),
- Route('/shortener/shorten', demos.shortener.handlers.ShortenHandler, 'demos'),
- Route('/shortener/<:.*>', handlers_base.PageHandler, 'demos'),
- Route('/instapaper/add', demos.instapaper.handlers.AddHandler, 'demos'),
- Route('/instapaper/<:.*>', handlers_base.PageHandler, 'demos'),
- Route('/imgur/save', demos.imgur.handlers.SaveHandler, 'demos'),
- Route('/imgur/<:.*>', handlers_base.PageHandler, 'demos'),
+ Route('/mememator/proxy', demos.mememator.handlers.ProxyHandler, 'demos/mememator'),
+ Route('/mememator/<:.*>', handlers_base.PageHandler, 'demos/mememator'),
+ Route('/imagestudio/<:.*>', handlers_base.PageHandler, 'demos/imagestudio'),
+ Route('/twitpic/proxy', demos.twitpic.handlers.ProxyHandler, 'demos/twitpic'),
+ Route('/twitpic/upload', demos.twitpic.handlers.UploadHandler, 'demos/twitpic'),
+ Route('/twitpic/<:.*>', handlers_base.PageHandler, 'demos/twitpic'),
+ Route('/shortener/shorten', demos.shortener.handlers.ShortenHandler, 'demos/shortener'),
+ Route('/shortener/<:.*>', handlers_base.PageHandler, 'demos/shortener'),
+ Route('/instapaper/add', demos.instapaper.handlers.AddHandler, 'demos/instapaper'),
+ Route('/instapaper/<:.*>', handlers_base.PageHandler, 'demos/instapaper'),
+ Route('/imgur/save', demos.imgur.handlers.SaveHandler, 'demos/imgur'),
+ Route('/imgur/<:.*>', handlers_base.PageHandler, 'demos/imgur'),
Route('/<:.*>', handlers_base.PageHandler, 'demos')
]
@@ -37,6 +37,9 @@
routes.DomainRoute('webintents-org.appspot.com', [
Route('/<:.*>', handlers_base.PageHandler, 'webintents')
]),
+ routes.DomainRoute('webintents.org', [
+ Route('/<:.*>', handlers_base.PageHandler, 'webintents')
+ ]),
routes.DomainRoute('examples.webintents-org.appspot.com', exampleRoutes),
routes.DomainRoute('examples.webintents.org', exampleRoutes),
routes.DomainRoute('demos.webintents-org.appspot.com', demoRoutes ),
View
2  server/webintents/pages/discover
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "webintents/layouts/base.html" %}
{% block title %}Discover{% endblock %}
{% block headline %}Discover - http://webintents.org/discover{% endblock %}
{% block content %}
View
2  server/webintents/pages/edit
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "webintents/layouts/base.html" %}
{% block title %}Edit{% endblock %}
{% block headline %}Edit - http://webintents.org/edit{% endblock %}
{% block content %}
View
2  server/webintents/pages/faq.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "webintents/layouts/base.html" %}
{% block title %}Web Intents FAQ{% endblock %}
{% block headline %}Web Intents FAQ{% endblock %}
{% block head %}
View
2  server/webintents/pages/index.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "webintents/layouts/base.html" %}
{% block title %}Web Intents{% endblock %}
{% block headline %}Web Intents{% endblock %}
{% block head %}
View
2  server/webintents/pages/pick
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "webintents/layouts/base.html" %}
{% block title %}Pick{% endblock %}
{% block headline %}Pick - http://webintents.org/pick{% endblock %}
{% block content %}
View
2  server/webintents/pages/save
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "webintents/layouts/base.html" %}
{% block title %}Save{% endblock %}
{% block headline %}Save - http://webintents.org/save{% endblock %}
{% block content %}
View
2  server/webintents/pages/share
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "webintents/layouts/base.html" %}
{% block title %}Share{% endblock %}
{% block headline %}Share - http://webintents.org/share{% endblock %}
{% block content %}
View
2  server/webintents/pages/subscribe
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "webintents/layouts/base.html" %}
{% block title %}Subscribe{% endblock %}
{% block headline %}Subscribe - http://webintents.org/subscribe{% endblock %}
{% block content %}
View
2  server/webintents/pages/view
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "webintents/layouts/base.html" %}
{% block title %}View{% endblock %}
{% block headline %}View - http://webintents.org/view{% endblock %}
{% block content %}
View
2  server/widgets/pages/index.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "widgets/layouts/base.html" %}
{% block title %}Widgets{% endblock %}
{% block headline %}Widgets{% endblock %}
{% block content %}
View
2  server/widgets/pages/save.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "widgets/layouts/base.html" %}
{% block title %}Widgets: Save{% endblock %}
{% block headline %}Save{% endblock %}
{% block head %}
View
2  server/widgets/pages/share.html
@@ -1,4 +1,4 @@
-{% extends "layouts/base.html" %}
+{% extends "widgets/layouts/base.html" %}
{% block title %}Widgets: Share{% endblock %}
{% block headline %}Share{% endblock %}
{% block head %}
Please sign in to comment.
Something went wrong with that request. Please try again.