A db.TextProperty() has no index so you can't filter on it.
Why not set the PermLink value as the key_name for this object.
Then you can get the object with
Entry = Entries.get_by_key_name(perm_link_key)

2008/10/16 poppins <[EMAIL PROTECTED]>:
>
> I've tried a few different methods between Foo = Posts().all
> Foo.filter( "column =", value ), gql and a handful of other methods.
> No matter what I do, I don't seem to get this work work.
>
> [code]
> class EntryHandler(webapp.RequestHandler):
>  def get(self):
>    perm_link_key = utils.get_uri_info(self.request.path)
>    Entry = db.Query(Entries).filter('PermLink =',
> perm_link_key).get()
>
>    if Entry:
>      self.response.out.write("I tried to get this title post: " +
> Entry.Title)
>    else:
>      self.response.out.write("Error: 404")
> [/code]
>
> I've double and tripple checked that utils.get_uri_info is working
> correctly.  When you go to /entry/YYYY/MM/DD/post-title it returns
> YYYY/MM/DD/post-title, PermLink is correctly set when looking at the
> Data Viewer in the Dashboard, but no object is returned.  :(
>
> Model:
> [code]
> class Entries(db.Model):
>  Title    = db.TextProperty(required=True)
>  Body     = db.TextProperty(required=True)
>  Created  = db.DateTimeProperty(auto_now_add=True)
>  Author   = db.TextProperty(required=True, default="Anonymous")
>  DelKey   = db.TextProperty(required=True)
>  AuthorIP = db.TextProperty(required=True)
>  Date     = db.TextProperty(required=True)
>  PermLink = db.TextProperty(required=True)
> [/code]
>
> Storing The Data:
> [code]
>  def post(self):
>    delete_key = utils.make_delete_key(self.request.remote_addr)
>    (month,day,year) = utils.get_mdy()
>    perm_url = str(year) + "/" + str(month) + "/" + str(day) + "/" +
> utils.make_safe_url(self.request.get('title'))
>    entry_body = markup( self.request.get('body') )
>
>    Entry = Entries(
>      Body     = entry_body,
>      Title    = cgi.escape(self.request.get('title')),
>      Author   = cgi.escape(self.request.get('name')),
>      DelKey   = delete_key,
>      AuthorIP = self.request.remote_addr,
>      Date     = time.asctime() + " " + time.tzname[0],
>      PermLink = perm_url)
>    Entry.put()
> [/code]
>
> make_safe_url
> [code]
> def make_safe_url( string ):
>    string = string.lower()
>    string = re.sub(r'[^a-z0-9\s]', '', string )
>    string = re.sub(r'\s+', '-', string)
>    return string
> [/code]
>
> index.yaml
> [code]
> indexes:
> - kind: Entries
>  properties:
>  - name: PermLink
>  - name: Created
> [/code]
>
> Anyone see what I'm doing wrong?
>
> Anyone know what I'm doing wrong?
> >
>

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

Reply via email to