[google-appengine] Re: Hit the 10 application limit.

2010-05-25 Thread Ms. Jen
It would be nice if one could pay a fee to have additional apps added
on to one's main account.  I have not seen that option and others have
recommended just opening another account under another name to get 10
more.

Then again, if you are doing the apps for a client, then going the
Google App + App Engine would be the way to go, as it does not eat
into your app allowance.  With the GAE for Business announced this
last week, it should be even easier.

GAE team: If we can have over the quota paid, should we not have over
the 10 app limit payment scheme?

smiles, jen ;o)

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: Need Help with Datastore Query

2010-01-05 Thread Ms. Jen
Hi Wesley!

Bizarrely, or not so much, many solutions to ongoing/hard problems
come to me at night, so during a bout of insomnia the night before
last, my brain said, "Research how to get by Key, then unit test for
ID in the SDK console." And so, I did today and it now is working!
Yay.

Here is the solution I found, since I did want to use the unique ID
but didn't quite know how to get there as I kept getting different
errors.

Code that is now working happily:
k = self.request.get('id')
q = int(k)
band = Band.get_by_id(q)
template_values = {
'band': band,
}
path = os.path.join(os.path.dirname(__file__), 'editband.html')
self.response.out.write(template.render(path, template_values))

In explanation, I had to separate out the requesting of the id in the
string of the URL from making the id an integer before getting from
the datastore, as every time I tried to combine the first two lines
into
k= int(self.request.get('id'))
I got an error about integers as noted in one of my many emails above.

Now it is working, I have a clean URL, as I did not want to use the
Key, and I don't have to worry about using the band name in the URL.
I have two more things to fix in the post part of edit band, and then
I can share the url on appspot with you all.

Once again, thanks for all the input.
-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Re: Need Help with Datastore Query

2010-01-03 Thread Ms. Jen
Ok, the results of an evening spent reading docs, searching for
answers, and otherwise beating my head against the GAE wall, is the
following:

If I pass the band name (band.band_name) on the URL, I am able to
search for it in the datastore with:

band_edit = Band.gql("WHERE band_name = 'id'")

And the page is rendered with just the band in question and not a
whole list of them.  Well, that was easy. So, why don't I use it?
Because people can have several bands of the same name or misspell the
name or the like, and a unique ID as the entity ID would be much more
useful and accurate over time.

But if I try with the ID or Key, I have no luck.  If I pass the ID as
band_id and then put it to the database as another string or integer
entity named band_id, and then try and search the datastore as above:

band_edit = Band.gql("WHERE band_id = 'id'")

I have no luck.  None.  (Yes, None with a big N). Either I get a
blank page or I am told that it can't iterate Band or there is an
integer or string error.

According to: 
http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html#Queries_on_Keys
there are limited queries on Keys and IDs allowed.

I know that folks can do it, as I have seen GAE python based apps that
call individual entities by a URL id.  Yes, the docs say you can, but
with no concrete examples.  Is there a cookbook recipe for how to get
by ID or Key?



--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Re: Need Help with Datastore Query

2010-01-03 Thread Ms. Jen
Oh, never mind on my last message dated Jan 3 at 5:19pm.  On my
localhost, the query only ran for the only entity I had, but when I
deployed it, I got 6 bands and not just the band by the id I wanted.

Back to drawing/hacking board.

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Re: Need Help with Datastore Query

2010-01-03 Thread Ms. Jen
Thanks everyone for your replies!  Happy New Year.

Hi Wesley -  You rock, your solution worked.  Now I want to know why
it worked.  ;o)

Here is the code that is rendering my edit band page per your
suggestion:

  def get(self):
band_edit = Band.gql('')
for band in band_edit:
  template_values = {
  'band_edit': band_edit,
   }
  path = os.path.join(os.path.dirname(__file__), 'editband.html')
  self.response.out.write(template.render(path, template_values))

How does the second line of Band.gql('') know to pull the band.key.id
from the URL and then use it to only grab the Band entity with the ID
of 2?
Or is it because I have my application = webapp.WSGIApplication mapped
to ('/editband/?$', EditBand) in my main.py?  Does python then look
for whatever is the ?$ and then uses that to run the Band.gql('')?

Inquiring minds wish to understand the zen of abstract Python.

Thanks!

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Re: Need Help with Datastore Query

2009-12-29 Thread Ms. Jen
Thanks all for your replies and input.

I was avoiding using the entity Key, as it is such a mix of
alphanumeric and the entity ID is a straight iterative integer, which
makes for a cleaner URL.

I will try the above in the morning and report back how it goes.

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Re: Need Help with Datastore Query

2009-12-29 Thread Ms. Jen
Hi Wesley!

I have been putting about GAE for a year now, but only in the last few
months have hit a wall trying to combine what I know Python can do vs.
what the docs say GAE can do.

One of the first things I did was to make sure that the first two
lines of code were actually able to get and call the ID in question.
I had a test logging line that was able to get the accurate ID #.

So the real issue I am having is will GAE allow me to pass a dynamic
variable into the datastore?  Most all of the examples in the docs are
literal strings, thus I was not sure if I should be encasing the
variable in quotes or not.

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Re: Need Help with Datastore Query

2009-12-29 Thread Ms. Jen
Avoid casting for what? The number 1 or for an id?

Are you saying that one should not be attempting to request a
datastore ID from a URL?  From a search of this and other groups, over
a year ago there was a bug in getting by the ID, but it is not a bug
anymore.

If I take out the in(self.request.get('id')), then I get an error that
says:
BadValueError: Unsupported type for property  : 

Do you have another way that you prefer to pass an identifier in the
URL path that then the identifier may be passed to the next datastore
search?  If so, please send link.

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Re: Need Help with Datastore Query

2009-12-28 Thread Ms. Jen


I tried the Meta and DjangoForms and it still did not work.


On another attempt, I tried this with the Meta & djangoforms:

id = int(self.request.get('id'))
band_id = Band.getBandByID(id)
query = Band.gql("WHERE ID = :1",
'band_id')
band_edit = query.get()
self.response.out.write(template.render('editband.html',
{'band_edit':
band_edit }))

which will render the page but not the form between the

{% for band in band_band %} {% endfor %}

in the template and it is not displaying the Band.db entity
properties.

If I add :
for band in band_edit:
  self.response.out.write(template.render('editband.html',
{'band_edit':
band_edit }))

I then get the error:
TypeError: 'NoneType' object is not iterable

Which leads me to think that the id as band_id is not being passed to
the query.

Anyone?


--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Need Help with Datastore Query

2009-12-27 Thread Ms. Jen
Hello All(),

I have been struggling with attempting to run a datastore query and
keep getting the same error even though I have read through all the
docs on Queries and Keys, watching several of the Google I/O videos,
as well as looking at a number other apps' source code to see how they
are done.

The error I get is:

Traceback (most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/ext/webapp/__init__.py", line 507, in __call__
handler.get(*groups)
  File "/Users/msjen/Dev/alex/alexsbarbooking/editband.py", line 41,
in get
self._displayEditBandPage()
  File "/Users/msjen/Dev/alex/alexsbarbooking/editband.py", line 32,
in _displayEditBandPage
raise ValueError, 'Band with ID %d does not exist.' % id
ValueError: Band with ID 2 does not exist.

My code is:
id = int(self.request.get('id'))
band_id = Band.get(db.Key.from_path('Band', id))
if band_id:
  band_query = Band.gql("WHERE ID = ", id)
  band = band_query.fetch(1)
  self.response.out.write('Band query successful. %s : %d' %
band.band_name, id)
  if not band_edit:
raise ValueError, 'Band query with ID %d did not get the info
from the datastore.' % id
if not band_id:
  raise ValueError, 'Band with ID %d does not exist.' % id

I have imported the db.model of band:
from band import Band

The other error I get if I use other code samples is that the global
variable of 'band' is not recognized, even though I have imported the
model.

the URL path that I am requesting the id from is: 
http://localhost:8080/editband/?id=2
And I am able to run a self.write.reponse to write out the requested
id from the path.

The problem seems to lie in passing the requested path id into the
query where I want to filter it by the requested id.

Please, please, tell me that another set of eyes can spot what I am
doing wrong here

Thanks in advance,
Jen

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Re: Displaying Images within Templates

2009-01-05 Thread Ms. Jen


Boson, you got it...  it should have been /img?img_id

It is always the little things that trip me up.

Thanks for the help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Displaying Images within Templates

2009-01-05 Thread Ms. Jen

When I try the straight code from the "Using Images" (http://
code.google.com/appengine/docs/images/usingimages.html) that writes
the html directly from the main.py file, my image display works.  When
I use templates that are separate from the main.py file, the images
don't display even though they are in the datastore and show up when I
view the source of the html page.

Please look at my code and tell me if I am missing a call or if the
MainPage class needs a reference for the image...

Template Page:


What it is outputting:


The main.py is below.  I am getting the same results both in dev and
on my testing spot on GAE. Thanks in advance for your help!

Jen



import cgi
import datetime
import os
import logging

from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import images
from google.appengine.ext.webapp import template

logging.getLogger().setLevel(logging.DEBUG)


class Greeting(db.Model):
  author = db.UserProperty()
  fullname = db.StringProperty()
  know = db.StringProperty()
  avatar = db.BlobProperty()
  year = db.StringProperty()
  title = db.StringProperty()
  content = db.TextProperty()
  date = db.DateTimeProperty(auto_now_add=True)

class MainPage(webapp.RequestHandler):
  def get(self):
greetings_query = Greeting.all().order('-date')
greetings = greetings_query.fetch(10)

if users.get_current_user():
  url = users.create_logout_url(self.request.uri)
  url_linktext = 'Logout'
  path = os.path.join(os.path.dirname(__file__), 'post.html')
else:
  url = users.create_login_url(self.request.uri)
  url_linktext = 'Login'
  path = os.path.join(os.path.dirname(__file__), 'index.html')

template_values = {
  'greetings': greetings,
  'url': url,
  'url_linktext': url_linktext,
  }

self.response.out.write(template.render(path, template_values))

class Image (webapp.RequestHandler):
  def get(self):
greeting = db.get(self.request.get("img_id"))
if greeting.avatar:
  self.response.headers['Content-Type'] = "image/png"
  self.response.out.write(greeting.avatar)
else:
  self.response.out.write("No image")

class Guestbook(webapp.RequestHandler):
  def post(self):
greeting = Greeting()

if users.get_current_user():
  greeting.author = users.get_current_user()
greeting.fullname = self.request.get('fullname')
greeting.know = self.request.get('know')
avatar = images.resize(self.request.get('img'), 32, 32)
greeting.avatar = db.Blob(avatar)
greeting.year = self.request.get('year')
greeting.title = self.request.get('title')
greeting.content = self.request.get('content')
greeting.put()
self.redirect('/')


application = webapp.WSGIApplication(
  [('/', MainPage),
   ('/img', Image),
   ('/sign', Guestbook)],
   debug=True)

def main():
  run_wsgi_app(application)

if __name__ == '__main__':
  main()

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---