def display(self, templateFile, params={}): path = os.path.join( os.path.dirname(__file__) + '/../templates/', templateFile) user = users.get_current_user() if user: isAdmin = user.email() == "*****@*****.**" else: isAdmin = False # Add some default parameters params['status'] = self.status params['APP_URL'] = 'http://joel.poloney.com/galleria' params['user'] = user params['isAdmin'] = isAdmin # Get 5 most recent albums params['recentAlbums'] = Album.gql("ORDER BY created DESC LIMIT 5") # Get All categories params['categories'] = Category.all() # Get information for stats section params['numAlbums'] = Album.all().count() params['numPhotos'] = Photo.all().count() self.response.out.write(template.render(path, params))
def display(self,templateFile,params={}): path=os.path.join(os.path.dirname(__file__) + '/../templates/', templateFile) user=users.get_current_user() if user: isAdmin=user.email() == "*****@*****.**" else: isAdmin=False # Add some default parameters params['status']=self.status params['APP_URL']='http://joel.poloney.com/galleria' params['user']=user params['isAdmin']=isAdmin # Get 5 most recent albums params['recentAlbums']=Album.gql("ORDER BY created DESC LIMIT 5") # Get All categories params['categories']=Category.all() # Get information for stats section params['numAlbums']=Album.all().count() params['numPhotos']=Photo.all().count() self.response.out.write(template.render(path, params))
def get(self): term = self.request.get('s') photos = Photo.all().search(term, properties=['name', 'description']).order('name') logging.info(photos.count()) params={ 'term':term, 'photos':photos, 'hasPhotos':photos.count() > 0 } self.display('search.html', params)