ericaddison / APT_miniProject

0 stars 0 forks source link

Patrick geomap #70

Closed psigourney closed 7 years ago

psigourney commented 7 years ago

Latitude and Longitude values are printing correctly from Service_UploadFile.py, but 'None' is being stored on the StreamItem entity.

psigourney commented 7 years ago

Even tried hardcoding a value to the StreamItem create, but the value in the store is 'None'. Is there another function which creates StreamItem records?

            item = StreamItem.create(
                owner=user,
                file=upload,
                URL=image_url,
                name=name,
                stream=stream,
                latitude="hello",
                longitude=lng)
psigourney commented 7 years ago

of course. There's a helper function "create" in Ndbclasses.py

So where is this function called from?

    @ classmethod
def create(cls, **kwargs):
    # gather arguments
    required_keys = ["name", "owner", "URL", "stream"]
    for key in required_keys:
        if "name" not in kwargs.keys():
            raise TypeError('Missing required key "{}"'.format(key))
    name = kwargs['name']
    owner = kwargs['owner']
    url = kwargs['URL']
    stream = kwargs['stream']
    blob = kwargs['file'] if 'file' in kwargs.keys() else None
    blobkey = blob.key() if blob is not None else None

     #  create and return stream
    item = StreamItem(
            owner=owner.key,
            blobKey=blobkey,
            URL=url,
            name=name,
            stream=stream.key)
    item.put()
    return item

ohhhhh.... Service_UploadFile.py is calling this function.

Okay.... I get it now. Now it's working.

ericaddison commented 7 years ago

Cool!