Exemple #1
0
    def get(self):
	categories = Category.all()
	answer_rows = ""
        for category in categories:
            answer_rows = answer_rows +  "<tr><td>%s</td><td>%s</td></tr> \n" % (cgi.escape(category.category), cgi.escape(category.description)) 
        params = {"page_title" : "New Category",
    		  "rows_result" : answer_rows }        
        path = os.path.join(os.path.dirname(__file__), '../views/listcategories.html')
        self.response.out.write(template.render(path, params))        
Exemple #2
0
    def get(self):
	categories = Category.all()
	select_options = ""
        for category in categories:
            select_options = select_options +  "<option value='%s'> %s</option>\n" % (cgi.escape(category.category), cgi.escape(category.category)) 
        params = {"page_title" : "New Url",
            	  "select_options" : select_options }
        path = os.path.join(os.path.dirname(__file__), '../views/form_url.html')
        self.response.out.write(template.render(path, params))        
Exemple #3
0
    def post(self):
	category = Category()
	category.category  = self.request.get('category').encode('utf-8')
	category.description  = self.request.get('description').encode('utf-8')
	category.put()
        self.redirect("/addcategory")
#!/usr/bin/env python
#
import os
import sys
from google.appengine.ext import db
from google.appengine.ext.remote_api import remote_api_stub
import getpass

appengine_dirs = ['/home/colarte/dev/google_appengine/']
sys.path.extend(appengine_dirs)
my_root_dir = os.path.abspath(os.path.dirname('/home/colarte/dev/python/GAE/colarte-dev/'))
sys.path.insert(0, my_root_dir)

APP_NAME = 'colarte-dev'
os.environ['AUTH_DOMAIN'] = 'gmail.com'

def auth_func():
    return (raw_input('Username:'******'Password:'******'localhost:8080'
# Otherwise, remote_api assumes you are targeting APP_NAME.appspot.com
remote_api_stub.ConfigureRemoteDatastore(APP_NAME, '/remote_api', auth_func)
from myapp.models.urlstore import Category
categories = Category.all()
for cat in categories:
    print cat.category