[google-appengine] Upload data to datastore
Hi there. I'm trying to upload some data to datastore, I can't use CSV bulk uploader because my data is not just text. Part of the data is an image. So I decide to make a python script to call a POST method on the server and go saving each row of my data. I test on local environment and works well, but after upload the application, my script receive an error 405 Method POST not allowed. I define my request class on server: class BulkUpload(webapp.RequestHandler): def post(self): model.put() On the client i'm using a script to call a url content_type, body = encode_multipart_formdata(fields, files) #here i put all my data h = httplib.HTTP(host) h.putrequest('POST', selector) h.putheader('content-type', content_type) h.putheader('content-length', str(len(body))) h.endheaders() h.send(body) errcode, errmsg, headers = h.getreply() Thanks for your 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Displaying image from Blob
I think is the content-type it should be image/jpeg On 10 nov, 14:53, Toney <[EMAIL PROTECTED]> wrote: > I’m trying to display an image from the data store using the hello > world sample. When I run the code below I get a blank image displayed > in FireFox. I'm sure the image is uploaded because when I initially > tried {{ greeting.pic1|escape }} in the html file I got a bunch of > garbage back. > > Can someone pls let me know what i'm doing wrong. > > class Greeting(db.Model): > author = db.UserProperty() > date = db.DateTimeProperty(auto_now_add=True) > pic1 = db.BlobProperty() > > class GetImage(webapp.RequestHandler): > > def get(self): > > query_str = "SELECT * FROM Greeting ORDER BY date DESC LIMIT > 10" result[0] > self.response.headers['Content-Type'] = 'image/jpg' > self.response.out.write(result.picture) > > application = webapp.WSGIApplication( > [('/upload/', MainPage), > ('/upload/sign', Guestbook), > ('/pic', GetImage)], > debug=True) > > --HTML--- > {% for greeting in greetings %} > > > > {% endfor %} --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Upload data to datastore
Hi Jeff, thanks for your interest. Yes I'm sure about that because my program works well when is in development. This is the output of my client script: file result/tmp.png host localhost:8080 selector /bulkupload fields [('part1', '0'), ('part2', '0'), ('part3', '0')] result 2 ... result/tmp.png localhost:8080 /bulkupload [('part1', '0'), ('part2', '0'), ('part3', '1')] 3 result/tmp.png localhost:8080 /bulkupload [('part1', '0'), ('part2', '0'), ('part3', '2')] 4 result/tmp.png localhost:8080 /bulkupload [('part1', '0'), ('part2', '0'), ('part3', '3')] 5 The log of the development server is: INFO 2008-11-12 16:23:58,736 __init__.py] Server: appengine.google.com INFO 2008-11-12 16:23:59,326 __init__.py] Running application my- mood on port 8080: http://localhost:8080 INFO 2008-11-12 16:24:23,802 __init__.py] "POST /bulkupload HTTP/ 1.0" 200 - INFO 2008-11-12 16:24:23,804 __init__.py] Detected manual index.yaml, will not update INFO 2008-11-12 16:24:23,966 __init__.py] "POST /bulkupload HTTP/ 1.0" 200 - INFO 2008-11-12 16:24:24,104 __init__.py] "POST /bulkupload HTTP/ 1.0" 200 - INFO 2008-11-12 16:24:24,257 __init__.py] "POST /bulkupload HTTP/ 1.0" 200 - INFO 2008-11-12 16:24:24,406 __init__.py] "POST /bulkupload HTTP/ 1.0" 200 - INFO 2008-11-12 16:24:24,559 __init__.py] "POST /bulkupload HTTP/ 1.0" 200 - INFO 2008-11-12 16:24:24,735 __init__.py] "POST /bulkupload HTTP/ 1.0" 200 - INFO 2008-11-12 16:24:25,054 __init__.py] "POST /bulkupload HTTP/ 1.0" 200 - INFO 2008-11-12 16:24:25,278 __init__.py] "POST /bulkupload HTTP/ 1.0" 200 - So this show me that all is going fine. But after un update to the GAE server, this is the result on my client script: file result/tmp.png host my-mood.appspot.com selector /bulkupload fields [('part1', '0'), ('part2', '0'), ('part3', '0')] result 405 Method Not Allowed <!-- body {font-family: arial,sans-serif} div.nav {margin-top: 1ex} div.nav A {font-size: 10pt; font-family: arial,sans-serif} span.nav {font-size: 10pt; font-family: arial,sans-serif; font-weight: bold} div.nav A,span.big {font-size: 12pt; color: #cc} div.nav A {font-size: 10pt; color: black} A.l:link {color: #6f6f6f} A.u:link {color: green} //--> <!-- var rc=405; //--> Google Error Method Not Allowed The request method POST is inappropriate for the URL /bulkupload. Thanks for your help. Cheers. On 11 nov, 21:18, Jeff S <[EMAIL PROTECTED]> wrote: > Hi Marcelo, > > Are you sure that the selector requested by the client is mapping to > the BulkUpload RequestHandler? The error that your client receives > sounds like the default error when the invoked request handler doesn't > have a post method. > > Cheers, > > Jeff > > On Nov 10, 10:46 am, Marcelo <[EMAIL PROTECTED]> wrote: > > > Hi there. > > > I'm trying to upload some data to datastore, I can't use CSV bulk > > uploader because my data is not just text. Part of the data is an > > image. So I decide to make a python script to call a POST method on > > the server and go saving each row of my data. > > > I test on local environment and works well, but after upload the > > application, my script receive an error 405 Method POST not allowed. > > > I define my request class on server: > > > class BulkUpload(webapp.RequestHandler): > > def post(self): > > > > model.put() > > > On the client i'm using a script to call a url > > > content_type, body = encode_multipart_formdata(fields, files) > > #here i put all my data > > h = httplib.HTTP(host) > > h.putrequest('POST', selector) > > h.putheader('content-type', content_type) > > h.putheader('content-length', str(len(body))) > > h.endheaders() > > h.send(body) > > errcode, errmsg, headers = h.getreply() > > > Thanks for your 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: 'The requested URL / was not found on this server.'
I have the same problem and after I redeploy the app this works for me. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/EjKnsqeP7iAJ. 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] Re: How to achieve Twtter of FB-like dynamism on Appengine
This is an idea that I just had. What if you group users in clusters? On Facebook I have friends that are relatives, coworkers, other professional contacts, classmates from college, dozens of fellow Rush fans, some celebrities with millions of followers, and some people that I randomly met. Each of these groups of friends makes a cluster which is possible to identify automatically by analyzing the graph of relationships among users. I think, every good book on graphs and data structures has a couple of algorithms that does just that. I believe that an user with 1k relationships may be a member of no more than one or two dozens of clusters, thus you could record updates on a "Cluster entity and not on the user and when the user queries its updates you just have to read the updates on all clusters that the user is a member of. You could even use a cache for online users, make smaller clusters for most active users, organize clusters on an hierarchical mode to make it more scalable, and so on. But, of course it is just an idea that I haven't tested. []s -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/dRvjC_Oe7MwJ. 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] Re: Understanding "The App Engine Way"
I think you are missing the point. The goal of this App Engine way is to *force* you to use cache, You only have to query once when the data is modified, then you store the results on a server cache and you can serve as many page views you want with no further access to the datasore, Super fast and with no extra charge. But doesn't it mean I'll have lots of data in cache? Yes, but that is the point: no matter how fast HRD can be, a replicated database will never be as fast as a standalone RDBMS for most trivial queries. So, it is not because Google wants profit more on your queries, but the fact is that you can never have an efficient webapp or webpage based on a cloud-based service if you don't do a lot of caching. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/cTg5NdWsadgJ. 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] Re: Understanding "The App Engine Way"
Yep, It's memcache. Indeed there is space for everything on memcache but it doesn't mean you'll store everything there. Each case is different, but my general rule is: 1) For every new query, I store its result on memcache, 2) When the same query is repeated I get the result from the cache instead of the datastore. 3) When data is updated I don't need to update the new information on cache, I just clear all occurrences of the old data on cache, thus the next time that record is queried, it'll not find it on cache anymore and it'll be forced to retrieve it from the datastore. You can make some optimization. For instance if you have a query in cache with a parameter like "field1 = '10'" with less than 100 records, and the user queries for "field1 = '10' AND field2 ='blue', than it is cheaper to make a loop on your cache and get only the blue ones, than querying the datastore again.But this is just an example of optimization, in some cases it is not worthwhile, in other cases you'll need to do much more to get an acceptable performance. Eventually your cache will be flooded with data that is not frequently used. You can make a specific routine to deal with it but for most of the cases an adjust on the memcache timeout may be enough. Short timeout will produce a high number of datastore calls, long timeouts will make your cache accumulate lots of useless data. You can monitor your app and find out which is the best timeout for you. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/tznxpwxIlEYJ. 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] Cloud SQL: CancelledError: The API call rdbms.CloseConnection() was explicitly cancelled
Hi, When using AppEngine with Cloud SQL, most queries run fine, but some queries give the error below. It's really hard to trace because it's sporadic. Anyone bumped into this issue before? Thanks! Marcelo Traceback (most recent call last): File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 223, in Handle result = handler(dict(self._environ), self._StartResponse) File "/base/python27_runtime/python27_lib/versions/third_party/django-1.4/django/core/handlers/wsgi.py", line 243, in __call__ signals.request_finished.send(sender=self.__class__) File "/base/python27_runtime/python27_lib/versions/third_party/django-1.4/django/dispatch/dispatcher.py", line 172, in send response = receiver(signal=self, sender=sender, **named) File "/base/python27_runtime/python27_lib/versions/third_party/django-1.4/django/db/__init__.py", line 46, in close_connection conn.close() File "/base/python27_runtime/python27_lib/versions/third_party/django-1.4/django/db/backends/__init__.py", line 299, in close self.connection.close() File "/base/python27_runtime/python27_lib/versions/1/google/storage/speckle/python/api/rdbms.py", line 711, in close self.MakeRequest('CloseConnection', request) File "/base/python27_runtime/python27_lib/versions/1/google/storage/speckle/python/api/rdbms.py", line 797, in MakeRequest response = self.MakeRequestImpl(stub_method, request) File "/base/python27_runtime/python27_lib/versions/1/google/storage/speckle/python/api/rdbms_apiproxy.py", line 66, in MakeRequestImpl apiproxy_stub_map.MakeSyncCall('rdbms', stub_method, request, response) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 94, in MakeSyncCall return stubmap.MakeSyncCall(service, call, request, response) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 320, in MakeSyncCall rpc.CheckSuccess() File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_rpc.py", line 133, in CheckSuccess raise self.exception CancelledError: The API call rdbms.CloseConnection() was explicitly cancelled. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/OGtzUsgus_AJ. 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] Developing in Google Cloud
Hi, I was pretty impressed to see the advances in kubernetes at the GCP event ... but at the same time, I cant help but feel it is a step backwards and sideways. Just a bit. See, we are making the effort to develop on App Engine, we went where you think we should go... so what now? we should go back to VMs and local mysql servers? There was nothing mayor announced for GAE, if it was mentioned at all. Or did I miss something? Please correct me if I did. Pricing wise, it seems more expensive since you need 3 VMs for a Container which will be used by kubernetes. App Engine Flexible also uses VMs but not sure how the pricing for that will be once it is out of Beta. So what is the future of GAE? going to fade out? Thoughts? -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/0585ac7b-d52a-43bd-b915-37e98c9875a6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[google-appengine] UnsupportedClassVersionError - Google Cloud's Jenkins VM (Compute Engine) is messing up my JSP compilation version
I'm 100% sure that, in my local environment everything is being compiled with JDK7.. but I don't know what's going on in the Compute Engine VM (Jenkins) that is part of my Google Cloud App's pipeline. Please, any help/suggestion would be extremely appreciated. version 52.0, java.lang.UnsupportedClassVersionError: org/apache/jsp/index_jsp : Unsupported major.minor version 52.0] at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:656) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:199) -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/d/optout.
[google-appengine] Asp.Mvc core always sees requests as HTTP
I just hosted an Asp.Mvc app in AppEngine (flex environment), and everything is going ok. Now, I want my app to be served only over https. Right now, I can access it both from http and https. The problem is that if I check the incoming request, it always shows as HTTP (even if the request comes from https). So, there is no way for me to detect and try to redirect (since a redirect will always produce an infinite redirection loop). Is there any way I can set this outside my app? The documentation doesn't has any information on this. Regards, -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/79d79b06-4b5a-44e1-8d3c-ffd77257e087%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[google-appengine] Getting __title__ is not defined error
Hi, I'm getting the following error message when trying to run my application: 1 if __title__ == "__main__": 2 main() __title__ undefined : name '__title__' is not defined args = ("name '__title__' is not defined",) message = "name '__title__' is not defined" Were is the URL I'm accessing : http://127.0.0.1:8080/ Here is the content of my app.yaml file: application: arcthingpad version: 1 runtime: python api_version: 1 handlers: - url: /stylesheets static_dir: stylesheets - url: /.* script: arcthingpad.py And here is the content of my arcthingpad.py file: if __title__ == "__main__": main() I removed all the code logic, just to be sure I wasn't doing anything stupid. Still I'm getting this error and the helloworld application works normally. Any ideas? --~--~-~--~~~---~--~~ 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] Problem when storing a integer into a model(GQL)
Here is the model I'm trying to update: class ManifestVersion(db.Model): versionNumber = db.IntegerProperty() Here is the method that should change the only instance of the previous model: def incrementVersion(): versionList = ManifestVersion.all() num = versionList[0].versionNumber num = num+1 versionList[0].versionNumber = num versionList[0].put() return versionList[0].versionNumber But the versionNumber value is never updated and this function always returns 1. On the other hand num is changed in this call. What am I 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 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] Re: Problem when storing a integer into a model(GQL)
I found something interesting. If i don't try to commit the versionNumber, its value is set to 1. Could it be something wrong with in my model? On Mar 15, 8:03 am, Tim Hoffman wrote: > Here's some things to look at. > > versionumber must be 0 when you fetch it, are you sure there is only > one instance of ManifestVersion, > and if there is supposed to be only one, why the call to > ManifestVersion.all(), you should just get the object by id or key. > (Have you confirmed that there is only one instance returned from all > () ?) > my guess is you have more than one instance > > T > > On Mar 15, 1:55 pm, Marcelo Sena wrote: > > > Here is the model I'm trying to update: > > > class ManifestVersion(db.Model): > > versionNumber = db.IntegerProperty() > > > Here is the method that should change the only instance of the > > previous model: > > > def incrementVersion(): > > versionList = ManifestVersion.all() > > num = versionList[0].versionNumber > > num = num+1 > > versionList[0].versionNumber = num > > versionList[0].put() > > return versionList[0].versionNumber > > > But the versionNumber value is never updated and this function always > > returns 1. On the other hand num is changed in this call. > > What am I 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 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] Re: Problem when storing a integer into a model(GQL)
There is only one instance of ManifestVersion. I used versionList.count () and it returned 1. And I'm not really looking into ensuring the uniqueness in ManifestVersion. Latter that model will disappear and become just a variable in the user entity(which I haven't created yet), but thanks for the suggestion. On Mar 15, 9:33 am, Marcelo Sena wrote: > I found something interesting. If i don't try to commit the > versionNumber, its value is set to 1. Could it be something wrong with > in my model? > > On Mar 15, 8:03 am, Tim Hoffman wrote: > > > Here's some things to look at. > > > versionumber must be 0 when you fetch it, are you sure there is only > > one instance of ManifestVersion, > > and if there is supposed to be only one, why the call to > > ManifestVersion.all(), you should just get the object by id or key. > > (Have you confirmed that there is only one instance returned from all > > () ?) > > my guess is you have more than one instance > > > T > > > On Mar 15, 1:55 pm, Marcelo Sena wrote: > > > > Here is the model I'm trying to update: > > > > class ManifestVersion(db.Model): > > > versionNumber = db.IntegerProperty() > > > > Here is the method that should change the only instance of the > > > previous model: > > > > def incrementVersion(): > > > versionList = ManifestVersion.all() > > > num = versionList[0].versionNumber > > > num = num+1 > > > versionList[0].versionNumber = num > > > versionList[0].put() > > > return versionList[0].versionNumber > > > > But the versionNumber value is never updated and this function always > > > returns 1. On the other hand num is changed in this call. > > > What am I 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 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] What does Model.to_xml() returns?
I know what the docs say, but what kind of xml is that, is a string or a object and what is the type of that object? I tried using type() on it and it returned nothing. I need to turn my model into a XML to use it in a javascript. Regards, Marcelo Sena. --~--~-~--~~~---~--~~ 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] Re: What does Model.to_xml() returns?
Here is my model: class NoteModel(db.Model): title = db.StringProperty(multiline=False) content = db.ListProperty(type('string')) And the values are: title:'Foo' content: ['bar'] And the result of: class getANote(webapp.RequestHandler): def get(self): query=Models.NoteModel.all() fnote=query.get() xmlrep=fnote.to_xml() self.response.out.write(xmlrep) called from: function stateChanged() { if (xmlHttp.readyState==4) { var xmlDoc=xmlHttp.responseXML; document.getElementById("txtHint").innerHTML=xmlDoc; } } But the result is: Exactly, nothing. What am I doing wrong? On Mar 20, 4:25 pm, Marcelo Sena wrote: > I know what the docs say, but what kind of xml is that, is a string or > a object and what is the type of that object? I tried using type() on > it and it returned nothing. > I need to turn my model into a XML to use it in a javascript. > Regards, > Marcelo Sena. --~--~-~--~~~---~--~~ 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] Re: What does Model.to_xml() returns?
So I tried a more direct approach to this problem: function stateChanged() { if (xmlHttp.readyState==4) { if (xmlHttp.responseXML==null)alert("Null"); var xmlDoc=xmlHttp.responseXML.documentElement; document.getElementById("companyname").innerHTML= xmlDoc.getElementsByTagName("compname")[0].childNodes[0].nodeValue; document.getElementById("contactname").innerHTML= xmlDoc.getElementsByTagName("contname")[0].childNodes[0].nodeValue; document.getElementById("address").innerHTML= xmlDoc.getElementsByTagName("address")[0].childNodes[0].nodeValue; document.getElementById("city").innerHTML= xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue; document.getElementById("country").innerHTML= xmlDoc.getElementsByTagName("country")[0].childNodes[0].nodeValue; } } The responseXML is always null so the line after the alert box always crashes. Here is the response handler I'm using: class getANote(webapp.RequestHandler): def get(self): #query=Models.NoteModel.all() #fnote=query.get() self.response.out.write(''' Foo bar ball bwal XD ''') The xml is said well formatted using w3c validator. Now what I'm doing wrong, is this a app engine error? Help please! On Mar 20, 9:53 pm, Marcelo Sena wrote: > Here is my model: > class NoteModel(db.Model): > title = db.StringProperty(multiline=False) > content = db.ListProperty(type('string')) > And the values are: > title:'Foo' > content: ['bar'] > > And the result of: > > class getANote(webapp.RequestHandler): > def get(self): > query=Models.NoteModel.all() > fnote=query.get() > xmlrep=fnote.to_xml() > > self.response.out.write(xmlrep) > > called from: > > function stateChanged() > { > if (xmlHttp.readyState==4) > { > var xmlDoc=xmlHttp.responseXML; > document.getElementById("txtHint").innerHTML=xmlDoc; > > } > > } > > But the result is: > > Exactly, nothing. What am I doing wrong? > > On Mar 20, 4:25 pm, Marcelo Sena wrote: > > > I know what the docs say, but what kind of xml is that, is a string or > > a object and what is the type of that object? I tried using type() on > > it and it returned nothing. > > I need to turn my model into a XML to use it in a javascript. > > Regards, > > Marcelo Sena. --~--~-~--~~~---~--~~ 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] Problems with the logging system?
Somebody knows if there is a problem with the logging system? I am trying to log but my messages never appear there. The requests just appear when I selected show requests only on the combo. If I mark the checkbox to show requests nothing appears. Very strange behaviour. Thanks. Marcelo --~--~-~--~~~---~--~~ 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] Re: Problems with the logging system?
Do you mean in the class? I got a logger with the full class name and used logger.info(). Used it from the java.util.logging. The logging console is working fine for you? On Mon, May 25, 2009 at 4:50 AM, 风笑雪 wrote: > Have you set logging level? > > 2009/5/25 Marcelo Alcantara > > Somebody knows if there is a problem with the logging system? >> >> I am trying to log but my messages never appear there. >> >> The requests just appear when I selected show requests only on the combo. >> If I mark the checkbox to show requests nothing appears. >> >> Very strange behaviour. >> >> Thanks. >> >> Marcelo >> >> >> > > > > -- Marcelo Alcantara Senior Developer/Architect mar...@gmail.com +55 11 81968823 --~--~-~--~~~---~--~~ 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] Re: Problems with the logging system?
Hi Rmac, I just had to change it too. Very simple. Maralc 2009/5/26 Rmac > > I was responding to the original poster who indicated the question was > for Java GAE. I finally determined that the default logging level in > logging.properties needed to be INFO level to work with log4j (which I > am using). > > On May 26, 7:26 pm, 风笑雪 wrote: > > As I said, I only focus on Python, maybe you need ask to this group: > http://groups.google.com/group/google-appengine-java > > > > 2009/5/27 Rmac > > > > > > > > > > > > > Yes, I have done all that was indicated in the documentation. Are you > > > saying you have successfully used Java logging and seen output on > > > GAE's console? > > > > > On May 26, 12:27 pm, 风笑雪 wrote: > > > > Have you done the doc said? > > >http://code.google.com/intl/en/appengine/docs/java/runtime.html#Logging > > > > > > 2009/5/26 Rmac > > > > > > > I just set up my app deployment today so I am not experienced with > the > > > > > Java app engine, but I also cannot see any logger.info() messages > > > > > either. If you get it working, I'd like to know how you did it. > > > > > > > On May 25, 5:31 am, Marcelo Alcantara wrote: > > > > > > Do you mean in the class? > > > > > > > > I got a logger with the full class name and used logger.info(). > Used > > > it > > > > > from > > > > > > the java.util.logging. > > > > > > > > The logging console is working fine for you? > > > > > > > > On Mon, May 25, 2009 at 4:50 AM, 风笑雪 wrote: > > > > > > > Have you set logging level? > > > > > > > > > 2009/5/25 Marcelo Alcantara > > > > > > > > > Somebody knows if there is a problem with the logging system? > > > > > > > > >> I am trying to log but my messages never appear there. > > > > > > > > >> The requests just appear when I selected show requests only on > the > > > > > combo. > > > > > > >> If I mark the checkbox to show requests nothing appears. > > > > > > > > >> Very strange behaviour. > > > > > > > > >> Thanks. > > > > > > > > >> Marcelo > > > > > > > > -- > > > > > > Marcelo Alcantara > > > > > > Senior Developer/Architect > > > > > > > > > > > > mar...@gmail.com > > > > > > +55 11 81968823 > > > -- Marcelo Alcantara Senior Developer/Architect mar...@gmail.com +55 11 81968823 --~--~-~--~~~---~--~~ 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] Re: Getting __title__ is not defined error
Yeah I tried to stop this message after I sent it, well I'll try to be more careful when renaming fields, thanks anyway! On Mon, Mar 9, 2009 at 9:32 PM, Paul Roy wrote: > > have you tried __name__ instead of __title__ ..? > > Sent from my iPhone > > On 09-03-09, at 15:28, Marcelo Sena wrote: > > > > > Hi, I'm getting the following error message when trying to run my > > application: > > > > 1 if __title__ == "__main__": > >2 main() > > __title__ undefined > > > > : name '__title__' is not defined > > args = ("name '__title__' is not defined",) > > message = "name '__title__' is not defined" > > > > > > Were is the URL I'm accessing : > > > > http://127.0.0.1:8080/ > > > > Here is the content of my app.yaml file: > > > > application: arcthingpad > > version: 1 > > runtime: python > > api_version: 1 > > > > handlers: > > > > - url: /stylesheets > > static_dir: stylesheets > > > > > > - url: /.* > > script: arcthingpad.py > > > > And here is the content of my arcthingpad.py file: > > > > if __title__ == "__main__": > > main() > > > > I removed all the code logic, just to be sure I wasn't doing anything > > stupid. Still I'm getting this error and the helloworld application > > works normally. > > > > Any ideas? > > > > > > > > > -- Marcelo Sena --~--~-~--~~~---~--~~ 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] Re: What does Model.to_xml() returns?
Yes, I needed to set the headers. Thanks! However I still don't know what should I do to convert the exit of to_xml() from the model class into something useful. Any ideas? On Tue, Mar 24, 2009 at 10:41 AM, Gijsbert wrote: > > You could use Live HTTP Headers in Firefox (for instance) to make sure > that the browser is getting valid data. > Maybe you need to set the content-type of the response to 'text/xml' > for the browser to initialize responseXML: > > self.response.headers['Content-Type'] = 'text/xml' > > On Mar 23, 11:10 am, Marcelo Sena wrote: > > So I tried a more direct approach to this problem: > > > > function stateChanged() > > { > > if (xmlHttp.readyState==4) > > { > > if (xmlHttp.responseXML==null)alert("Null"); > > var xmlDoc=xmlHttp.responseXML.documentElement; > > document.getElementById("companyname").innerHTML= > > xmlDoc.getElementsByTagName("compname")[0].childNodes[0].nodeValue; > > document.getElementById("contactname").innerHTML= > > xmlDoc.getElementsByTagName("contname")[0].childNodes[0].nodeValue; > > document.getElementById("address").innerHTML= > > xmlDoc.getElementsByTagName("address")[0].childNodes[0].nodeValue; > > document.getElementById("city").innerHTML= > > xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue; > > document.getElementById("country").innerHTML= > > xmlDoc.getElementsByTagName("country")[0].childNodes[0].nodeValue; > > > > } > > } > > > > The responseXML is always null so the line after the alert box always > > crashes. > > > > Here is the response handler I'm using: > > > > class getANote(webapp.RequestHandler): > > def get(self): > > #query=Models.NoteModel.all() > > #fnote=query.get() > > > > self.response.out.write(''' > encoding='ISO-8859-1'?> > > > > Foo > > bar > > ball > > bwal > > XD > > > > ''') > > > > The xml is said well formatted using w3c validator. Now what I'm doing > > wrong, is this a app engine error? Help please! > > > > On Mar 20, 9:53 pm, Marcelo Sena wrote: > > > > > Here is my model: > > > class NoteModel(db.Model): > > > title = db.StringProperty(multiline=False) > > > content = db.ListProperty(type('string')) > > > And the values are: > > > title:'Foo' > > > content: ['bar'] > > > > > And the result of: > > > > > class getANote(webapp.RequestHandler): > > > def get(self): > > > query=Models.NoteModel.all() > > > fnote=query.get() > > > xmlrep=fnote.to_xml() > > > > > self.response.out.write(xmlrep) > > > > > called from: > > > > > function stateChanged() > > > { > > > if (xmlHttp.readyState==4) > > > { > > > var xmlDoc=xmlHttp.responseXML; > > > document.getElementById("txtHint").innerHTML=xmlDoc; > > > > > } > > > > > } > > > > > But the result is: > > > > > Exactly, nothing. What am I doing wrong? > > > > > On Mar 20, 4:25 pm, Marcelo Sena wrote: > > > > > > I know what the docs say, but what kind of xml is that, is a string > or > > > > a object and what is the type of that object? I tried using type() > on > > > > it and it returned nothing. > > > > I need to turn my model into a XML to use it in a javascript. > > > > Regards, > > > > Marcelo Sena. > > > > > > > -- Marcelo Sena --~--~-~--~~~---~--~~ 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] Re: What does Model.to_xml() returns?
Ok it does returns a string, magically everything is fine now thanks for all the help! On Mon, Apr 13, 2009 at 4:49 PM, Marcelo de Sena Lacerda < marceloslace...@gmail.com> wrote: > Yes, I needed to set the headers. Thanks! > However I still don't know what should I do to convert the exit of to_xml() > from the model class into something useful. Any ideas? > > > On Tue, Mar 24, 2009 at 10:41 AM, Gijsbert wrote: > >> >> You could use Live HTTP Headers in Firefox (for instance) to make sure >> that the browser is getting valid data. >> Maybe you need to set the content-type of the response to 'text/xml' >> for the browser to initialize responseXML: >> >> self.response.headers['Content-Type'] = 'text/xml' >> >> On Mar 23, 11:10 am, Marcelo Sena wrote: >> > So I tried a more direct approach to this problem: >> > >> > function stateChanged() >> > { >> > if (xmlHttp.readyState==4) >> > { >> > if (xmlHttp.responseXML==null)alert("Null"); >> > var xmlDoc=xmlHttp.responseXML.documentElement; >> > document.getElementById("companyname").innerHTML= >> > xmlDoc.getElementsByTagName("compname")[0].childNodes[0].nodeValue; >> > document.getElementById("contactname").innerHTML= >> > xmlDoc.getElementsByTagName("contname")[0].childNodes[0].nodeValue; >> > document.getElementById("address").innerHTML= >> > xmlDoc.getElementsByTagName("address")[0].childNodes[0].nodeValue; >> > document.getElementById("city").innerHTML= >> > xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue; >> > document.getElementById("country").innerHTML= >> > xmlDoc.getElementsByTagName("country")[0].childNodes[0].nodeValue; >> > >> > } >> > } >> > >> > The responseXML is always null so the line after the alert box always >> > crashes. >> > >> > Here is the response handler I'm using: >> > >> > class getANote(webapp.RequestHandler): >> > def get(self): >> > #query=Models.NoteModel.all() >> > #fnote=query.get() >> > >> > self.response.out.write('''> > encoding='ISO-8859-1'?> >> > >> > Foo >> > bar >> > ball >> > bwal >> > XD >> > >> > ''') >> > >> > The xml is said well formatted using w3c validator. Now what I'm doing >> > wrong, is this a app engine error? Help please! >> > >> > On Mar 20, 9:53 pm, Marcelo Sena wrote: >> > >> > > Here is my model: >> > > class NoteModel(db.Model): >> > > title = db.StringProperty(multiline=False) >> > > content = db.ListProperty(type('string')) >> > > And the values are: >> > > title:'Foo' >> > > content: ['bar'] >> > >> > > And the result of: >> > >> > > class getANote(webapp.RequestHandler): >> > > def get(self): >> > > query=Models.NoteModel.all() >> > > fnote=query.get() >> > > xmlrep=fnote.to_xml() >> > >> > > self.response.out.write(xmlrep) >> > >> > > called from: >> > >> > > function stateChanged() >> > > { >> > > if (xmlHttp.readyState==4) >> > > { >> > > var xmlDoc=xmlHttp.responseXML; >> > > document.getElementById("txtHint").innerHTML=xmlDoc; >> > >> > > } >> > >> > > } >> > >> > > But the result is: >> > >> > > Exactly, nothing. What am I doing wrong? >> > >> > > On Mar 20, 4:25 pm, Marcelo Sena wrote: >> > >> > > > I know what the docs say, but what kind of xml is that, is a string >> or >> > > > a object and what is the type of that object? I tried using type() >> on >> > > > it and it returned nothing. >> > > > I need to turn my model into a XML to use it in a javascript. >> > > > Regards, >> > > > Marcelo Sena. >> > >> > >> >> >> > > > -- > Marcelo Sena > -- Marcelo Sena --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---