Thanks Nick,

I thought I tried users.User already, but it looks like it works now.

Appreciate all the help.

Mike

On Sep 14, 7:29 am, "Nick Johnson (Google)" <[email protected]>
wrote:
> On Fri, Sep 11, 2009 at 9:43 PM, mjbruder <[email protected]> wrote:
>
> > Nick,
>
> > That worked perfectly. Thank you!
>
> > One more question. I'm now having some difficulty importing my
> > 'author' property because it says it needs to be a user. I get
> > BadValueError: Property author must be a User. However, if I just set
> > it to user, I get NameError: global name 'user' is not defined
>
> > Is there a conversion function for the UserProperty as well?
>
> Try "users.User", after importing google.appengine.api.users.
>
>
>
> > Also, is there somewhere I can find these conversion functions?
>
> There's nothing special about them -a 'conversion function' is any function
> that takes a string as its only argument and returns something else.
>
> -Nick Johnson
>
>
>
> > Thanks,
>
> > Mike
>
> > On Sep 11, 4:50 am, "Nick Johnson (Google)" <[email protected]>
> > wrote:
> > > Hi mjbruder,
> > > The easiest way to do this would be to define the conversion function for
> > > exporting 'stores' as follows:
>
> > > lambda x: ":".join(str(y) for y in x)
>
> > > And the conversion function for imports as follows:
>
> > > lambda x: [db.Key(y) for y in x.split(":")]
>
> > > -Nick Johnson
>
> > > On Thu, Sep 10, 2009 at 3:43 PM, mjbruder <[email protected]> wrote:
>
> > > > I'm attempting to use the bulkloader to load data into my app. I have
> > > > my loader/exporter set up with the following classes:
>
> > > > class FoodItemLoader(bulkloader.Loader):
> > > >  def __init__(self):
>
> > > >    bulkloader.Loader.__init__(self, 'FoodItem',
> > > >                               [('author', str),
> > > >                                ('name', str),
> > > >                                ('brand', str),
> > > >                                ('price', str),
> > > >                                ('category', str),
> > > >                                ('stores', list)
> > > >                               ])
>
> > > > class FoodItemExporter(bulkloader.Exporter):
> > > >  def __init__(self):
> > > >    bulkloader.Exporter.__init__(self, 'FoodItem',
> > > >                                 [('author', str, None),
> > > >                                  ('name', str, None),
> > > >                                  ('brand', str, None),
> > > >                                  ('price', str, None),
> > > >                                  ('category', str, None),
> > > >                                  ('stores', list, None),
> > > >                                 ])
>
> > > > exporters = [FoodItemExporter]
> > > > loaders = [FoodItemLoader]
>
> > > > ---
>
> > > > The exporter seems to work fine, and it exports a column with the
> > > > following type of data in it for the stores list property
> > > > "[datastore_types.Key.from_path(u'Store', 3002L,
> > > > _app_id_namespace=u'grocerygeek')]"
>
> > > > Unfortunately, I cannot use this same format to load data into my
> > > > datastore because it gives me the following error "BadValueError:
> > > > Items in the stores list must all be Key instances"
>
> > > > Is there a way I can format my CSV file or my code to accept this type
> > > > of data?
>
> > > --
> > > Nick Johnson, Developer Programs Engineer, App Engine
>
> --
> Nick Johnson, Developer Programs Engineer, App Engine
> Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
> 368047
--~--~---------~--~----~------------~-------~--~----~
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