Code Monkey home page Code Monkey logo

appengine-rest-server's People

Watchers

 avatar

appengine-rest-server's Issues

content-type of "application/xml" not working

This line of code is always return JSON: 
        out_mime_type = self.request.accept.best_match([JSON_CONTENT_TYPE, XML_CONTENT_TYPE])

I do see XML when running in the browser, but not when doing a "urlfetch". 

What steps will reproduce the problem?

1. Do an urlfetch/get like this: 

      contentType = "application/xml"
      try:
          result = urlfetch.fetch(url=restURL,
                      method=urlfetch.GET,
                      headers={'Content-Type': contentType})
          showResults = result.content 
      except: 
          showResults = sys.exc_info()

  and then display the variable "showResults". 




What is the expected output? What do you see instead?
  Expecting XML, see JSON.  


What version of the product are you using? On what operating system?
  You should put the version number in your code so I would know. 

I added the followign to your rest.__init__.py to debug by capturing a history 
of each REST request to the database.  The contentType and contentType2 show 
different values. 

class RestHistory(db.Model):
    dateTimeCreated     = db.DateTimeProperty(auto_now=True) 
    contentType         = db.StringProperty()
    contentType2        = db.StringProperty()
    content             = db.TextProperty() 
    username            = db.StringProperty()

    def doc_to_output(self, doc):
        restHistory = RestHistory(); 
        out_mime_type = self.request.accept.best_match([JSON_CONTENT_TYPE, XML_CONTENT_TYPE])
        if(out_mime_type == JSON_CONTENT_TYPE):
            self.response.disp_out_type_ = JSON_CONTENT_TYPE
        content = xml_to_json(doc)
        restHistory.contentType = out_mime_type 
        restHistory.contentType2 = self.request.headers["Content-Type"] 
            restHistory.content = content 
        restHistory.put() 
            return content 
        self.response.disp_out_type_ = XML_CONTENT_TYPE
    content =  doc.toxml(XML_ENCODING)
        content = xml_to_json(doc)
        restHistory.contentType = out_mime_type 
        restHistory.contentType2 = self.request.headers["Content-Type"] 
        restHistory.content = content 
    restHistory.put() 
        return content 


Thanks, looks like a great utility. 


Original issue reported on code.google.com by [email protected] on 12 Sep 2010 at 9:14

db.Expando Model Classes

WOW!  Nice work guys!  This is a fantastic project you developed here!  Within 
minutes I had a complete rest server going for my entire dataset, and was able 
to throw together a .Net synchronization module to utilize it in only hours.

WELL DONE.

I originally set out to find a quick and dirty method to upload my complex .Net 
object data to GAE, but when I saw how easy your rest-server made things, I 
have started to envision a full blown .Net data access layer for all sorts of 
specialized winforms applications.

However, I am looking to modify the rest server, and I am hoping to get some 
input.

I have one class that is based on the expando model.  I want to modify the rest 
server to allow specification of the datatype of the expando properties on PUT 
and POST methods.  For example, if the datatype is a Key() reference, currently 
the PUT and POST methods store that as a string value, rather than a Key() 
reference value.

I know I could just hack it up myself, but I think that with some guidance from 
you guys, I might be able to modify it the right way to make that functionality 
more generally useful.

Any input there?

Original issue reported on code.google.com by admin%[email protected] on 13 Sep 2010 at 2:25

Per-model pre & post hooks for GET/PUT/POST/DELETE

I would like to use different pre/post hooks for my models to perform 
operations related to the models.

For example, I might have a model like ExternalUserAccount and would want to do 
something like the following:

* POST /rest/ExternalUserAccount
  * pre-hook to check authentication & create the external user account via an RPC call
  * on success, model is created
  * on failure, model is not created
  * post-hook to log the account creation
  * return code/result

* DELETE /rest/ExternalUserAccount
  * pre-hook to check authentication & delete the external user account via an RPC call
  * on success, model is deleted
  * on failure, model is not deleted
  * post-hook to log the account deletion
  * return code/result

Do you have any plans to add support for that?  If not, can you recommend the 
best way I could achieve this?

Perhaps by creating pre-handler and post-handler classes, with get, put, post, 
delete methods that can return error codes, and extend webapp.RequestHandler?

These could be added with their corresponding models and called appropriately 
by Dispatch for each model?  Maybe something like:

rest.Dispatcher.add_handlers({
    'test' : (handlers.PreTestHooks, models.Test, handlers.PostTestHooks),
    'cache' : (handlers.PreCacheHooks, models.Cache, handlers.PostCacheHooks)
})


class PreTestHooks(webapp.RequestHandler):
    def get(self, key, property=None):
        # eg, check authentication
        # eg, perform additional operations
        # if there's a problem self.error(some_error_code)
        return

    def post(self, <no idea what would be here>):
        # eg, check authentication
        # eg, perform additional operations
        # if there's a problem self.error(some_error_code)
        return

    ... etc ...

class PostTestHooks(webapp.RequestHandler):
    def get(self, key, property=None):
        # eg, perform logging
        return

    def post(self, <no idea what would be here>):
        # eg, perform logging
        return

    ... etc ...

...

I'm guessing I could do something like the following example in Dispatch:

class Dispatch(object):
    ...
    def get_impl(...):
        # pre handle
        pre_handler = self.get_pre_handler(name)
        h = pre_handler(self.request, self.response)
        if ...
            h.get(key)
        elif ...
            h.get(key, property)

        ...
        model_handler = self.get_model_handler(name)
        if ...
            model_handler.get(key)
        elif ...
            model_handler.get_property_handler...

        # post handle
        post_handler = self.get_post_handler(name)
        h = post_handler(self.request, self.response)
        if ...
            h.get(key)
        elif ...
            h.get(key, property)

        write stuff

But, I have no idea how I would handle things such as failure to meet criteria 
or an application error etc inside the hooks.  Perhaps by simply adding 
exception handling code in the Dispatch along the lines of:

    try:
        ...
    exception HandlerHookException, status:
        self.error(status.code, status.reason)
        return

What do you think?  I'm keen to get the logic I need as well as data 
manipulation into the REST API.  I'm open to any and all suggestions.  Even if 
you know of another library that is as good as yours as handling XML/JSON but 
includes such hooks?

Cheers!

Original issue reported on code.google.com by [email protected] on 11 Jul 2010 at 8:49

Issue with matching Accept field in request header

Synopsis of problem:
- want to get json response from library
- send suitable (i think) accept header, but library interprets it as a
request for xml

What steps will reproduce the problem?

1. Modify doc_to_output in __init.py__ to get more log info

    def doc_to_output(self, doc):

        logging.info('Request Accept: '+self.request.accept.header_value)
        logging.info('JSON_CONTENT_TYPE:'+JSON_CONTENT_TYPE)
        logging.info('XML_CONTENT_TYPE:'+XML_CONTENT_TYPE)
        out_mime_type = self.request.accept.best_match([JSON_CONTENT_TYPE, XML_CONTENT_TYPE])
        logging.info(out_mime_type)
        if(out_mime_type == JSON_CONTENT_TYPE):
            self.response.disp_out_type_ = JSON_CONTENT_TYPE
            return xml_to_json(doc)
        self.response.disp_out_type_ = XML_CONTENT_TYPE
        return doc.toxml(XML_ENCODING)

(apologies for not using diff format)

2. Send HTTP request which has Accept with String 'application/json, */*'
3. (I did this with some JQuery stuff on Chrome)

What is the expected output? What do you see instead?

I would expect output to show that the request is soliciting
a JSON response. Instead, I see the following:

INFO     2010-10-21 21:29:27,129 __init__.py:1623] Request Accept: 
application/json, */*
INFO     2010-10-21 21:29:27,129 __init__.py:1624] 
JSON_CONTENT_TYPE:application/json
INFO     2010-10-21 21:29:27,129 __init__.py:1625] 
XML_CONTENT_TYPE:application/xml
INFO     2010-10-21 21:29:27,129 __init__.py:1627] application/xml

What version of the product are you using? On what operating system?

1.0.3

Please provide any additional information below.

Working with GoogleAppEngine release: "1.3.8"
timestamp: 1284157741
api_versions: ['1']
Using webapp - no special config.
Seems to be some strange behaviour localized to best_match - can't
find best_match to step through it.

Original issue reported on code.google.com by [email protected] on 21 Oct 2010 at 9:36

JSON output support

Can you add the capability for the server to return JSON as well as XML
based on the mime type requested?

Original issue reported on code.google.com by [email protected] on 9 Jul 2009 at 8:55

Do you provide complete code of a working app?

Do you provide any sample code for a working app that uses this? 

I've had success with queries.  Now here's what I'm trying to do: 
1) Send data to form, user changes data on form.  
2) Form comes back to python running on GAE.  I now want to do a PUT, which 
requires me to format either JSOn or XML.  Rather than building the JSON with 
my own code, I am trying to figure out how to call your code library to take an 
object from the db.Model and turn it into either JSON or XML, tnen I'll build 
my URLFETCH and do the put. 

I'm considering using REST calls even on the server to provide my API layer, 
and separate my GUI from the GAE backend.  

Sorry for reporting as issue, I don't see anywhere to discuss this utility. 

Thanks,
Neal 


Original issue reported on code.google.com by [email protected] on 20 Sep 2010 at 1:54

Ignore unknown properties

I have a model on server side with the following properties:
name
item

On client side (javascript) I am working with recieved object,  adding some 
temporary properties and trying to save it.

After this I get the following exception - Unknown property tmp"

Is it possible to add an option to skip unknown properties (just to log it 
somewhere, or even ignore them at all).

Original issue reported on code.google.com by [email protected] on 26 Oct 2011 at 10:03

BLOB data to mime types

What I'd like to be able to do is request the data from a specific row by
key and BlobProperty name and return it as a certain type (png, mp3, etc).

Original issue reported on code.google.com by [email protected] on 19 Aug 2009 at 9:18

Documentation: list types

It took me a while to figure out how the XML or JSON structure for list type 
properties need to look like. It was not obvious that the elements in the list 
need to be put into an object called 'item'. 

It would be helpful to document this:

XML: 
<myList><!-- elements NEED to be called 'item' -->
    <item>first element in list</item>
    <item>second element in list</item>
    <item>third</item>
</myList>

JSON:
myList: {
   'item': [ // NEEDS to be called 'item'!
      'first element in list',
      'second element in list',
      'third element in list'
   ]
}

Original issue reported on code.google.com by [email protected] on 13 Mar 2011 at 9:48

Query Cache stores one page, either XML or JSON

What steps will reproduce the problem?
1. Set HTTP "Accept: application/xml".
2. Query for a model, e.g. /rest/user/?fgt_age=30
3. Get an XML document response.
4. Change to HTTP "Accept: application/json".
5. Query the same URL, e.g. /rest/user/?fgt_age=30
6. Get the cached XML document response, again, not JSON.

What is the expected output? What do you see instead?

The cached page is the same MIME type as the first time it was requested. So, a 
cached XML document is returned for a JSON request.

The MIME type should be mangled into the memcache key, i.e. self.request.url, 
so that the XML and JSON pages are unique. I did this on my local copy of 
./rest/__init__.py to make:

out_mime_type= self.request.accept.best_match(self.output_content_types)
cache_key = self.request.url + out_mime_type

That works well enough.

What version of the product are you using? On what operating system?

I use the latest SVN /trunk/ download.

Please provide any additional information below.


Original issue reported on code.google.com by adroffner on 13 Jan 2012 at 6:06

Alternative way for PUT and DELETE

As you know most browsers have limited support on HTTP PUT and DELETE.

I have make it improved by:

DELETE: to GET 

http://localhost:8080/rest/Chngeo_Prov/agtmYW5mb3UtYXBwc3ISCxILQ2huZ2VvX1Byb3YYs
QEM/delete

PUT: to POST

http://localhost:8080/rest/Chngeo_Prov/agtmYW5mb3UtYXBwc3ISCxILQ2huZ2VvX1Byb3YYs
QEM/put

I have changed based on your code. Can I be a member of you and check in
the changes?

Thanks.


Original issue reported on code.google.com by [email protected] on 28 Jul 2009 at 12:08

Simplified Security

Be able to define what method types are allowed for a particular type in
configuration.

For instance, if I want a certain piece of data to only have public access
for the get method.

Original issue reported on code.google.com by [email protected] on 25 Aug 2009 at 1:20

Equality Query Parameter doesn't need "feq_" prefix

The equality query prefix "feq_" isn't needed, and makes simple queries fail. I 
made a small patch to let the plain property_name=value syntax work.

For example, this "looks" right, but won't work; it returns zero results. There 
is a "gender" property_name on the User model.

Desired Query: /rest/suds/user/?gender=male 

The current coder requires "feq_", which not natural.

Current Query: /rest/suds/user/?feq_gender=male 

I attached a GNU diff file of the patch on the SVN latest branch (as of 
yesterday). It simply assumes that an invalid operator prefix means "equality", 
and not to ignore the field.

Original issue reported on code.google.com by adroffner on 10 Jan 2012 at 4:23

Attachments:

Ordering of results

Anybody have any thoughts on if its possible to do ordering, and if so how
would we do it?  The concept of paged data is nice, but often the order of
items coming from appengine is not always what is relevant to my view.

Original issue reported on code.google.com by [email protected] on 13 Aug 2009 at 6:26

Initial setup

What steps will reproduce the problem?
1. Followed instructions adding _Init.PY_ from zipped dist to 
../helloworld/rest of GAE tutorial
2. http://localhost:8081/
3.

What is the expected output? What do you see instead?
File "D:\projects\GoogleAppEngine\Helloworld\helloworld.py", line 52, in 
<module>
    ('/rest/appengine-rest-server-1.0.4 (1)/src/main/python/rest/.*', rest.Dispatcher)],
TypeError: 'tuple' object is not callable

What version of the product are you using? On what operating system?
appengine-rest-server-1.0.4, windows xp/GAE

Please provide any additional information below.
Inexperienced with Python so I have probable misunderstood an instruction or 2.

Original issue reported on code.google.com by [email protected] on 2 Apr 2011 at 10:08

Attachments:

url extension as format

Is there anyway to add url extension as indicator for expected output format? 

Something like http://domain/resource.json would return json, and 
http://domain/resource.xml would return xml. 

Original issue reported on code.google.com by [email protected] on 23 May 2011 at 12:17

- replaced by _ in Dynamic Property Names

Hi,

I've encountered a problem with the rest server fetching a expando Model.

I'm using db Key's as names for the dynamic fields, resulting in a - in the 
name.
When fetching the items with the rest server the - in the key_name gets 
replaced by a _


Thanks a lot for the great rest server and with best regards

Gordon

Original issue reported on code.google.com by [email protected] on 6 Aug 2011 at 10:32

Authentication for requests

What steps will reproduce the problem?
1. Login to Google
2. Send a request
3. All results are returned instead of a filter containing only authorized 
results

What is the expected output? What do you see instead?
I would like to have the option to authenticate the rest queries. Is there any 
way to add a 
structure like this?

What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 26 Jun 2009 at 11:06

Allow Queries on Dynamic Properties

GET Queries do not allow dynamic properties. This is a defect because the code 
raises an AttributeError that the method can_query() is not found.

I attached a GNU Diff files with changes to allow dynamic property queries. It 
is very functional, but consider fine tuning it.

It coerces the name=value string into native Python types using regular 
expressions. It does so w/o consulting the Property class (which is not 
possible here). Quotes string are an escape so that StringProperty values can 
otherwise match the REs.

Python Types
============
1) float: f=3.14 or f=2.0 (the dot and a nmber after is required.)
2) integet: f=12
3) datetime: Use your parse_date_time() function and DATE_TIME_FORMAT_NO_MS.
4) time: Use your parse_date_time() function and TIME_FORMAT_NO_MS, with 
leading "T".
5) Anything else is a unicode string.

ESCAPE RULE: types #1 to #4 can be in quotes: "3.14" or "T23:00:00" to be 
strings.

DataStore Query and Type
========================
Per GAE, the DataStore will only consider records where the dynamic property 
type matches the coerced Python type. The client must handle this.

Original issue reported on code.google.com by adroffner on 13 Jan 2012 at 6:54

Attachments:

Rest API works correctly on live server but does not work on localhost

What steps will reproduce the problem?
1. http://appname.appspot.com/api/rest/metadata gives a list of available 
metadata
2. http://localhost:8080/api/rest/metadata gives empty page

What is the expected output? What do you see instead?
Any url that I go to inside of http://localhost:8080/api/rest just gives me an 
empty page, no 
errors or anything.

What version of the product are you using? On what operating system?
Mac OS X

I don't even know how to debug this, because exactly the same code works on 
live server but 
does not work on dev.

Original issue reported on code.google.com by [email protected] on 20 Sep 2009 at 1:17

memcache.get and memcache.set methods don't exist

What steps will reproduce the problem?
1. Create a project into Aptana with App engine Python 2.7
2. put into it the file __init__.py
3.

What is the expected output? What do you see instead?
There are errors on the get and set methods of the memcache object:
Undefined variable from import: get

What version of the product are you using? On what operating system?
Python 2.7
AppEngine 1.6.1

Original issue reported on code.google.com by [email protected] on 29 Dec 2011 at 10:14

51 items being sent when max is 50

What steps will reproduce the problem?
51 items being sent when max is 50

What is the expected output? What do you see instead?
If my page size if 50, my output should be 50

Please provide any additional information below.
Is this really necessary?

# if possible, attempt to fetch more than we really want so that we can
determine if we have more results
        tmp_fetch_page_size = cur_fetch_page_size
        if(tmp_fetch_page_size < MAX_FETCH_PAGE_SIZE):
            tmp_fetch_page_size += 1

I was noticing that there wasn't an offset value when you've reached the
last page.  Is it possible to use that as an indicator instead of an extra
value?

Original issue reported on code.google.com by [email protected] on 13 Aug 2009 at 4:53

Submodule classes not loaded.

What steps will reproduce the problem?
1. I have the following files structure:

  main.py
  service
  \- __init__.py
   - model
    \- __init__.py
     - Employee.py

2. I am trying to load all classes from "service.model" module using this 
command:

  rest.Dispatcher.add_models_from_module("service.model")

3. Also in service/model/__init__.py I have the following import:

  from Employee import Employee

I do not want this import in service/__init__.py because it is not 'service' 
problem.



What is the expected output? What do you see instead?

I think it should show
<types>
  <type>Employee</type>
</types>

or 

<types>
  <type>service_model_Employee</type>
</types>

with module names.

But it show empty </types> tag.



What version of the product are you using? On what operating system?

appengine-rest-server-1.0.5.zip, Win7



Please provide any additional information below.

I think this can be fixed in add_models_from_module function (make it 
recursively):


    def add_models_from_module(cls, model_module, use_module_name=False, exclude_model_types=None,
                               model_methods=ALL_MODEL_METHODS):
        logging.info("adding models from module %s" % model_module)
        if(not exclude_model_types):
            exclude_model_types=[]
        if(isinstance(model_module, basestring)):
            model_module = __import__(model_module)

        cls.add_models_from_module_recursively(model_module, use_module_name, exclude_model_types, model_methods)

    def add_models_from_module_recursively(cls, model_module, use_module_name, exclude_model_types, model_methods):
        logging.info("adding models from module %s" % model_module)
        module_name = ""
        if(use_module_name):
            module_name = get_type_name(model_module) + "."
        for obj_name in dir(model_module):
            obj = getattr(model_module, obj_name)
            if(isinstance(obj, types.ModuleType)):
                cls.add_models_from_module_recursively(obj, use_module_name, exclude_model_types, model_methods)
            if(isinstance(obj, type) and issubclass(obj, db.Model) and (obj not in exclude_model_types)):
                model_name = module_name + get_type_name(obj)
                cls.add_model(model_name, obj, model_methods)


If it is not a bug, or you think it should be changed in another way - please 
let me know (I am working with python for the first day and not sure about 
python ideology).

Original issue reported on code.google.com by [email protected] on 20 Sep 2011 at 2:22

ability to retrieve child objects via references to parent properties

This is an enhancement split out from issue 29.  The request is for a way to 
retrieve actual child objects via parents.

e.g. given the models:

def Parent(db.Model):
  child = db.ReferenceProperty(Child)

def Child(db.Model):

currently, the url "http:{service}//rest/Parent/{Parent_Key}/child" would 
return you the key of the child object.  the request is for an alternate syntax 
the would return the actual Child object.

Original issue reported on code.google.com by [email protected] on 10 Apr 2011 at 11:56

Retrieval of "/rest/" results in "IndexError: pop from empty list"

What steps will reproduce the problem?
1. Deploy test Boomi app (Guestbook example w/ rest-server hooks) on dev server
2. Access http://127.0.0.1:8080/rest/

What is the expected output? What do you see instead?
Unsure since the result of "/rest/" is undefined in the documentation. The root 
should maybe return a list of the available URIs?

Since the example is specified as:
  ('/rest/.*', rest.Dispatcher)
the rest.Dispatcher should handle the root URL.

The dispatcher does not handle "/rest" but neither does any other. In theory it 
could be the same resource as "/rest/" but that is sort of up to the developer. 
But either way, it results in the creation of an empty resource within the URI.

What version of the product are you using? On what operating system?
1.0.5 on Fedora Core 14 w/ Google App Engine 1.6.0 & Python 2.7

Please provide any additional information below.
Traceback (most recent call last):
......
  File ".../Google_App_Engine/applications/resttest/rest/__init__.py", line 1363, in get_impl
    model_name = path.pop(0)
IndexError: pop from empty list

Original issue reported on code.google.com by [email protected] on 17 Nov 2011 at 6:56

support for blobstore.BlobReferenceProperty()

Currently if I query for an database entry which also stores a reference to an 
blobstore object I get this result:

<model>
<google.appengine.ext.blobstore.blobstore.BlobInfo object at 0x9cb96ec>
</model>

I would be great if you could return the complete download url (e.g. 
http://localhost:8080/blob/uyFuzwXn3uuw1fhdL_CRGA==) instead.

Original issue reported on code.google.com by [email protected] on 13 Jul 2010 at 9:26

JSON content type doesn't work when using jQuery

jQuery send  "application/json; charset=UTF-8" as a content type, even if 
"application/json" is explicitly set. Because input_to_xml() explicitly looks 
for "application/json", recognizing JSON input fails.

My workaround was to check for "application/json" as a substring of the 
content_type:

        if(content_type != None and content_type.find(JSON_CONTENT_TYPE) >= 0):

instead of 

        if(content_type == JSON_CONTENT_TYPE):



Original issue reported on code.google.com by [email protected] on 8 Mar 2011 at 9:02

List properties of db.Key values don't appear properly

When accessing a list property, one only gets the keys of the child elements 
instead of a list of the child elements:

e.g.
http:{service}//rest/ParentModel/{Parent_Key}/Property
should return a list of Property instances instead of a list of db.key that 
have to be fetched one-by-one from the database.


Original issue reported on code.google.com by [email protected] on 10 Apr 2011 at 12:04

not well-formed (invalid token) while post request

What steps will reproduce the problem?
1. Create app
2. Run dev_appserver.py
3. try request with curl

~/www/woa-toolkit/apps/Relviewmodel $ curl -vv -d "note=asfdadasdssdfsdfsss" 
"http://localhost:8080/rest/notes/"

* About to connect() to localhost port 8080 (#0)
*   Trying ::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST /rest/notes/ HTTP/1.1
> User-Agent: blabla
> Host: localhost:8080
> Accept: */*
> Content-Length: 24
> Content-Type: application/x-www-form-urlencoded
> 
* HTTP 1.0, assume close after body
< HTTP/1.0 500 Internal Server Error
< Server: Development/1.0
< Date: Mon, 12 Sep 2011 19:48:48 GMT
< Content-Type: text/html; charset=utf-8
< Cache-Control: no-cache
< Expires: Fri, 01 Jan 1990 00:00:00 GMT
< Content-Length: 1126
< 
<pre>Traceback (most recent call last):
  File &quot;/google_appengine/google/appengine/ext/webapp/_webapp25.py&quot;, line 703, in __call__
    handler.post(*groups)
  File &quot;~/www/gae/notes/rest/__init__.py&quot;, line 1441, in post
    self.post_impl()
  File &quot;~/www/gae/notes/rest/__init__.py&quot;, line 1458, in post_impl
    self.update_impl(path, model_name, model_key, &quot;POST&quot;, False)
  File &quot;~/www/gae/notes/rest/__init__.py&quot;, line 1483, in update_impl
    doc = self.input_to_xml()
  File &quot;~/www/gae/notes/rest/__init__.py&quot;, line 1698, in input_to_xml
    return minidom.parse(self.request.body_file)
  File &quot;/usr/lib/python2.6/xml/dom/minidom.py&quot;, line 1918, in parse
    return expatbuilder.parse(file)
  File &quot;/usr/lib/python2.6/xml/dom/expatbuilder.py&quot;, line 928, in parse
    result = builder.parseFile(file)
  File &quot;/usr/lib/python2.6/xml/dom/expatbuilder.py&quot;, line 207, in parseFile
    parser.Parse(buffer, 0)
ExpatError: not well-formed (invalid token): line 1, column 4
* Closing connection #0


~/www/gae/notes/rest $ svn info
Path: .
URL: http://appengine-rest-server.googlecode.com/svn/trunk
Repository Root: http://appengine-rest-server.googlecode.com/svn
Repository UUID: 8fab00bc-bfc3-11dd-b7f4-ab9653f8cbb3
Revision: 62
Node Kind: directory
Schedule: normal
Last Changed Author: jahlborn
Last Changed Rev: 62
Last Changed Date: 2011-08-06 15:11:59 +0300 (Sat, 06 Aug 2011)

App code in attach

Original issue reported on code.google.com by [email protected] on 12 Sep 2011 at 7:56

Attachments:

Not an issue, but feature request: Unique value return, and Bulk DELETE

Feature request (hope this is OK?) - Else delete it

1. Basically a toggle to return a list of 'unique' values
2. Bulk (list of Keys) delete capability
3. Bulk (based on supported query) delete capability

I love this Project!  

Suits me nicely for getting back into webdev after many years.

I can build my app purely in JavaScript, using this REST API. No need to worry 
at all about any Python could to manage Data.

I am sort of achieving the first two items with Jquery, but it a headache and 
memory intensive on larger tables to paging/local javascript unique function 
(rather than doing it the google side)

I achieve the last one getting the keys into an array, then looping a DELETE 
request many times on single 'key' DELETE. This is very slow, and page normally 
times out. I know it can be better writing another Python interface to 
Datastore, but I think REST is all anyone needs to build a great App!

BTW - Excellent job guys, and keep up the great work.
Can you setup up a donate button?
At least I can fund you some new mouse pads : )

When I do eventually find a real issue, will certainly let you know !






Original issue reported on code.google.com by [email protected] on 30 Sep 2011 at 4:27

Use json instead of simplejson if possible

For example replacing :

from django.utils import simplejson

by:

# using json instead of simplejson if it is available
try:
    import json
except ImportError:
    from django.utils import simplejson as json

And update the 2 mentions of simplejson.

(I did not tested yet)

Original issue reported on code.google.com by [email protected] on 29 Dec 2011 at 10:27

2+ second response time POST'ing JSON.

What steps will reproduce the problem?
1. POST JSON data to valid URL
2. Wait for response

I'm posting JSON data to http://localhost:8082/rest/phone_location

This is a test to determine performance.  The data I am posting is:

{"phone_location":{"sourceUDID":"xx11111","destinationUDID":"xx11123","coordinat
es":"2345.222"}}

Very simple example.

Round trip is taking 2+ seconds to complete both local and deployed.  Is JSON 
slower than XML for processing the data?


Original issue reported on code.google.com by bvelasquez on 23 Aug 2011 at 10:55

All numbers are represented as strings in JSON output

What steps will reproduce the problem?
1. Create a data model with some numbers, 
    SomeInt = db.IntegerProperty(default=0)
    SomeFloat = db.FloatProperty(default=-1.0)
2. Implement the rest services

3. Perform a Get and request JSON output. 


What is the expected output? What do you see instead?
EXPECTED:
"EntityName":
{
    "SomeInt": 1
    "SomeFloat": 1.0
}

RECEIVED:
"EntityName":
{
    "SomeInt": "1"
    "SomeFloat": "1.0"
} 

What version of the product are you using? On what operating system?
1.0.5

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 17 Jun 2011 at 9:37

Reduce GET data

Is it possible we can specify which columns we would like returned in the
data set?  That way we can reduce our load that gets returned per rest
request to only what we need and save $$$

Original issue reported on code.google.com by [email protected] on 19 Aug 2009 at 9:11

Update appengine-rest-server to work with webapp2 and python27

What steps will reproduce the problem?
1.  Use python27 and webapp2 
2.  See error when accessing the url defined by appengine-rest-server

What is the expected output? What do you see instead?
- I see error in the log when I try to access the rest url. I expect to see no 
error. 

What version of the product are you using? On what operating system?
python27, webapp2 , google-appengine

Please provide any additional information below.
I have attached the patch I made to make rest-server work with webapp2

Original issue reported on code.google.com by [email protected] on 2 Dec 2011 at 3:52

Attachments:

Bug when POSTing integers via JSON

What steps will reproduce the problem?
1. POST an entity with JSON containing a int field

What version of the product are you using? On what operating system?

latest

Please provide any additional information below.

To solve this I've patched json_node_to_xml this way :


def json_node_to_xml(xml_node, json_node):
    doc = xml_node.ownerDocument
    if(isinstance(json_node, basestring)):
        xml_node.appendChild(doc.createTextNode(json_node))
    elif (isinstance(json_node, int) or isinstance(json_node, long)):
        xml_node.appendChild(doc.createTextNode(str(json_node)))
    else:

Original issue reported on code.google.com by sylvinus on 1 Feb 2011 at 11:09

get entities by a list of keys

hi,

would it be possible to get entities by using a list of keys?

i've tried using the fin_ operator, though it seems not to work on keys.


once more thanks for the great project and with best regards


Original issue reported on code.google.com by [email protected] on 20 Aug 2011 at 1:51

Pagination of data

What steps will reproduce the problem?

I need a good way to page my data.  I know there are some server side
variables for how much data to return, but that seems a rather broad
stroke.  There seems to be a number of features I need:
1) ability to found out how many records there are of a given type
2) ability to request pages of data of varying size and offsets
3) ability to request all records

What is the expected output? What do you see instead?

I'm not sure what the best method to do this would be, but since we already
have a precedent with the "offset" querystring paramater, maybe "page_size"
would be nice

for count we could do /rest/metadata/mytype/count

Maybe by default, requests for rest types would not be paginated.  I found
it really confusing the first time around when I was calling /rest/mytype
and suddenly my list started getting truncated!


Original issue reported on code.google.com by [email protected] on 11 Aug 2009 at 4:31

key error when accessing the rest uri for the second time

What steps will reproduce the problem?
1. register models with rest.Dispatcher.add_models({'testuri': model})
2. 1st request: access /rest/testuri -> gives the desired response
3. 2nd request: access /rest/testuri -> gives a key error "name testuri 
already used"

What is the expected output? What do you see instead?
You should get the response for the 1st response, right?

What version of the product are you using? On what operating system?
gae sdk 1.3.0 & win xp

Please provide any additional information below.
adding rest.Dispatcher.model_handlers = {} before 
rest.Dispatcher.add_models() fixes the issue but this is not desired. Why 
are the model_handlers from the previous request still accessible in the 
2nd request? 

Original issue reported on code.google.com by m.e.siersema on 4 Feb 2010 at 9:46

No index for "Ordering"

I'm building some flexible database with appengine-rest-server. Everything is 
fine without building any index, unless "ordering" field is added, in that case 
I'll have to build index then upload the app again. Is there anyway to avoid 
this?

Original issue reported on code.google.com by [email protected] on 18 Sep 2011 at 6:56

Allow POST to accept multiple items to create

This is not really a bug, more of a feature request. In my use case, I 
need to create lots of records (20-100?) in one go. The current 
implementation only seems to accept one item at a time, so I have to do 
lots of roundtrips. I had a look at the source code, but I am a total zero 
in Python. I guess all that would be required is a loop in model_from_xml 
and to decide how to return the object identifiers.

Original issue reported on code.google.com by [email protected] on 20 Mar 2010 at 1:50

raise KeyError("name %s already used" % model_name)

What steps will reproduce the problem?
1. Run the application at the address http://localhost:8080/rest/metadata
2. Reload the application, get the error as in the summary

Traceback (most recent call last):
  File 
"/Users/foo/Documents/AppEngine/GoogleAppEngineLauncher.app/Contents/Resources/G
oogle
AppEngine-
default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_ap
pserver.p
y", line 3185, in _HandleRequest
    self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
  File 
"/Users/foo/Documents/AppEngine/GoogleAppEngineLauncher.app/Contents/Resources/G
oogle
AppEngine-
default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_ap
pserver.p
y", line 3128, in _Dispatch
    base_env_dict=env_dict)
  File 
"/Users/foo/Documents/AppEngine/GoogleAppEngineLauncher.app/Contents/Resources/G
oogle
AppEngine-
default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_ap
pserver.p
y", line 515, in Dispatch
    base_env_dict=base_env_dict)
  File 
"/Users/foo/Documents/AppEngine/GoogleAppEngineLauncher.app/Contents/Resources/G
oogle
AppEngine-
default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_ap
pserver.p
y", line 2387, in Dispatch
    self._module_dict)
  File 
"/Users/foo/Documents/AppEngine/GoogleAppEngineLauncher.app/Contents/Resources/G
oogle
AppEngine-
default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_ap
pserver.p
y", line 2297, in ExecuteCGI
    reset_modules = exec_script(handler_path, cgi_path, hook)
  File 
"/Users/foo/Documents/AppEngine/GoogleAppEngineLauncher.app/Contents/Resources/G
oogle
AppEngine-
default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_ap
pserver.p
y", line 2195, in ExecuteOrImportScript
    script_module.main()
  File "/Users/foo/Documents/AppEngine/helloworld/main.py", line 48, in main
    rest.Dispatcher.add_models({"user": UserModel})
  File "/Users/foo/Documents/AppEngine/helloworld/rest/__init__.py", line 845, in add_models
    cls.add_model(model_name, model_type)
  File "/Users/foo/Documents/AppEngine/helloworld/rest/__init__.py", line 863, in add_model
    raise KeyError("name %s already used" % model_name)
KeyError: 'name user already used'



Original issue reported on code.google.com by [email protected] on 13 Apr 2010 at 10:56

  • Merged into: #12

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.