Beispiel #1
0
from google.appengine.api import users
from google.appengine.ext import db
from os import environ
import cgi
import sandbox

user = sandbox.remote_user()

if environ["REQUEST_METHOD"] != "POST":

    entities_owned = sandbox.Entity.get_by_user(user)

    sandbox.template_response("user_home.html",
                              {"entities_owned": entities_owned})

else:

    fields = cgi.FieldStorage()
    mode = fields["mode"].value

    if mode == "create_entity":
        import uuid
        name = uuid.uuid4().hex
        entity = sandbox.Entity(name=name)
        entity.put()

    sandbox.redirect("/mine")
    print "Status: 404 Not Found"
    print "Content-Type: text/html"
    print ""
    print "no such entity"
    exit()


if environ["REQUEST_METHOD"] != "POST":

    #entities_owned = sandbox.Entity.get_by_user(user)

    messages = entity.messages_received.order("-receive_time").fetch(20)
    subscriptions = entity.subscriptions_from_remote_entities.order("-create_time").fetch(10)

    sandbox.template_response("entity_home.html", {"entity": entity,
                                                   "messages": messages,
                                                   "subscriptions": subscriptions,
                                                   "owned": owned})

elif owned:

    fields = cgi.FieldStorage()
    mode = fields["mode"].value

    if mode == "subscribe":
        remote_entity = fields["entity"].value
        remote_domain = fields["domain"].value
        disco_doc = sandbox.dfp_helper.discover(remote_domain)
        if disco_doc is None or "subscribe" not in disco_doc:
            logging.debug("The domain %r doesn't declare a subscribe endpoint", remote_domain)
            sandbox.template_response("entity_home_subscribe_fail.html", {})
            exit()
Beispiel #3
0
    print ""
    print "no such entity"
    exit()

if environ["REQUEST_METHOD"] != "POST":

    #entities_owned = sandbox.Entity.get_by_user(user)

    messages = entity.messages_received.order("-receive_time").fetch(20)
    subscriptions = entity.subscriptions_from_remote_entities.order(
        "-create_time").fetch(10)

    sandbox.template_response(
        "entity_home.html", {
            "entity": entity,
            "messages": messages,
            "subscriptions": subscriptions,
            "owned": owned
        })

elif owned:

    fields = cgi.FieldStorage()
    mode = fields["mode"].value

    if mode == "subscribe":
        remote_entity = fields["entity"].value
        remote_domain = fields["domain"].value
        disco_doc = sandbox.dfp_helper.discover(remote_domain)
        if disco_doc is None or "subscribe" not in disco_doc:
            logging.debug("The domain %r doesn't declare a subscribe endpoint",
from google.appengine.api import users
from google.appengine.ext import db
from os import environ
import cgi
import sandbox

user = sandbox.remote_user()

if environ["REQUEST_METHOD"] != "POST":

    entities_owned = sandbox.Entity.get_by_user(user)

    sandbox.template_response("user_home.html", {"entities_owned": entities_owned})

else:

    fields = cgi.FieldStorage()
    mode = fields["mode"].value

    if mode == "create_entity":
        import uuid
        name = uuid.uuid4().hex
        entity = sandbox.Entity(name=name)
        entity.put()

    sandbox.redirect("/mine")
from google.appengine.api import users
from os import environ
import cgi
import sandbox
import logging
import dfp
import urllib2

user = sandbox.remote_user()

if environ["REQUEST_METHOD"] != "POST":

    sandbox.template_response("try_associate.html", {})

else:

    fields = cgi.FieldStorage()
    target_domain = fields["domain"].value
    logs = []
    successful = False

    dfp_helper = sandbox.dfp_helper

    logging.info("User %r is attempting to associate with domain %r", user.nickname(), target_domain)

    try:
        discovery_url = dfp_helper.discovery_url_for_domain(target_domain)
        if discovery_url:
            logs.append("Discovery URL for this domain is %s" % discovery_url)
            try:
                associate_endpoint = dfp_helper.associate_endpoint_for_domain(target_domain)
from google.appengine.api import users
from os import environ
import cgi
import sandbox
import logging
import dfp
import urllib2

user = sandbox.remote_user()

if environ["REQUEST_METHOD"] != "POST":

    sandbox.template_response("try_associate.html", {})

else:

    fields = cgi.FieldStorage()
    target_domain = fields["domain"].value
    logs = []
    successful = False

    dfp_helper = sandbox.dfp_helper

    logging.info("User %r is attempting to associate with domain %r",
                 user.nickname(), target_domain)

    try:
        discovery_url = dfp_helper.discovery_url_for_domain(target_domain)
        if discovery_url:
            logs.append("Discovery URL for this domain is %s" % discovery_url)
            try: