Using StringListProperty efficently in Google App Engine


StringListProperty is a datastore value type that stores list items. Using StringListProperty is very easy: #!/usr/bin/env python from google.appengine.ext import webapp from google.appengine.ext.webapp import util from google.appengine.ext import db class Page(db.Model): title=db.StringProperty(multiline=False) keywords=db.StringListProperty() class MainHandler(webapp.RequestHandler): def get(self): newpage=Page() newpage.title=”Suat ATAN’s books” newpage.keywords=[“book”,”author”] newpage.put() newpage=Page() newpage.title=”Suat ATAN’s life” newpage.keywords=[“canada”,”author”] newpage.put() newpage=Page() newpage.title=”Suat ATAN’s gusto” newpage.keywords=[“coffe”,”pizza”] newpage.put()… Read More Using StringListProperty efficently in Google App Engine

Using StringListProperty efficently in Google App Engine


StringListProperty is a datastore value type that stores list items. Using StringListProperty is very easy: #!/usr/bin/env pythonfrom google.appengine.ext import webappfrom google.appengine.ext.webapp import utilfrom google.appengine.ext import dbclass Page(db.Model): title=db.StringProperty(multiline=False) keywords=db.StringListProperty()class MainHandler(webapp.RequestHandler): def get(self): newpage=Page() newpage.title=”Suat ATAN’s books” newpage.keywords=[“book”,”author”] newpage.put() newpage=Page() newpage.title=”Suat ATAN’s life” newpage.keywords=[“canada”,”author”] newpage.put() newpage=Page() newpage.title=”Suat ATAN’s gusto” newpage.keywords=[“coffe”,”pizza”] newpage.put() pages=Page().all().filter(“keywords” = “author”) for page… Read More Using StringListProperty efficently in Google App Engine

A new version of Python template maker


I developed a script early for dressing pages with demanded template here is newer version: from BeautifulSoup import BeautifulSoup #Configuration root=”D:/users/suat.atan/Desktop/yenisehrivan/” cssroot=”/htmlres/css/” jsroot=”/htmlres/js/” class TemplateMaker(): def generate(self,NUDEPAGE_NAME): NUDEPAGE=open(root+”pages/”+NUDEPAGE_NAME+”.html”).read() index=open(root+”pages/index.html”).read() soup = BeautifulSoup(index) head= soup.findAll(“head”) #header header_1=soup.findAll(“div”,id=”header”) #menu header_2=soup.findAll(“div”,id=”topmenu”) #change css css=soup.findAll(“link”,id=”maincss”) css[0][‘href’]=cssroot+NUDEPAGE_NAME+”.css” #change js js=soup.findAll(“script”,id=”mainjs”) js[0][‘src’]=jsroot+NUDEPAGE_NAME+”.js” HEADER=str(header_1[0])+str(header_2[0]) HEAD= str(head[0]) html1=”””\n “”” html2=”””\n “”” html3=” \n… Read More A new version of Python template maker

A new version of Python template maker


I developed a script early for dressing pages with demanded template here is newer version: from BeautifulSoup import BeautifulSoup#Configurationroot=”D:/users/suat.atan/Desktop/yenisehrivan/”cssroot=”/htmlres/css/”jsroot=”/htmlres/js/”class TemplateMaker(): def generate(self,NUDEPAGE_NAME): NUDEPAGE=open(root+”pages/”+NUDEPAGE_NAME+”.html”).read() index=open(root+”pages/index.html”).read() soup = BeautifulSoup(index) head= soup.findAll(“head”) #header header_1=soup.findAll(“div”,id=”header”) #menu header_2=soup.findAll(“div”,id=”topmenu”) #change css css=soup.findAll(“link”,id=”maincss”) css[0][‘href’]=cssroot+NUDEPAGE_NAME+”.css” #change js js=soup.findAll(“script”,id=”mainjs”) js[0][‘src’]=jsroot+NUDEPAGE_NAME+”.js” HEADER=str(header_1[0])+str(header_2[0]) HEAD= str(head[0]) html1=”””n “”” html2=”””n “”“ html3=” n n” sign=”” HTML=html1+HEAD+html2+HEADER+NUDEPAGE+html3 file =open(root+”pages/gen-“+NUDEPAGE_NAME+”.html”,”w”)… Read More A new version of Python template maker

Dreamweaver-like html template dressing in Aptana with Python


The best way for dressing multiple page with a single template is Dreamweaver HTML template system. This system is ok but not available in Aptana.  For this problem i coded a simple python script that can launchable under Aptana. This script reading head elements of main page for css and javascript’s after this asks the… Read More Dreamweaver-like html template dressing in Aptana with Python