[google-appengine] Re: about sharded counter
You need to reach the incremental method on the db object from a webapp.RequestHandler. From the source http://google-app-engine-samples.googlecode.com/svn/trunk/sharded-counters/main.py the counter-main-class is defined as: import generalcounter import simplecounter class CounterHandler(webapp.RequestHandler): Handles displaying the values of the counters and requests to increment either counter. def get(self): template_values = { 'simpletotal': simplecounter.get_count(), 'generaltotal': generalcounter.get_count('FOO') } template_file = os.path.join(os.path.dirname(__file__), 'counter.html') self.response.out.write(template.render(template_file, template_values)) def post(self): counter = self.request.get('counter') if counter == 'simple': simplecounter.increment() else: generalcounter.increment('FOO') self.redirect(/) So just make a post like the example eg. the simple counter: form action= method=post pinput type=hidden name=counter value=simple //p pinput type=submit value=Increment Simple //p /form And rewrite your class to your purpose by following the counter- example. If it to any help this i the source http://google-app-engine-samples.googlecode.com/svn/trunk/sharded-counters/simplecounter.py Did that make sence? :) On Jun 28, 8:13 am, xiaojay xiao...@gmail.com wrote: Hi guys, I am new to gae and knew count() only return the exact num only when the num is less than 1000 and I read the article about sharded counter here:http://code.google.com/intl/en/appengine/articles/sharding_counters.html. so I start to use it in my own project like this: import counter class MyModel(db.Model): name = db.StringProperty() #overwrite put so when new one is saved, counter + 1 def put(self): def txn(): counter.increment('MyModel') return super(Mymodel, self).put() return db.run_in_transaction(txn) howerver, when I test this code, get a error BadRequestError: Nested transactions are not supported. I know why. howerver, i can not figure out how to go through it beacuse i want save a entity and increase counter in a transaction any ideas? Thanks in advance --~--~-~--~~~---~--~~ 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: Url Fetch
Some restrictions is made to the urllib running in app engine due to security reasons. eg. urllib.fetch() is restricted to common HTTP ports like 80 and 443. On May 14, 5:47 pm, Paul Kinlan paul.kin...@gmail.com wrote: Hi Guys, My Sitewww.twollo.comis having some issues connection to Twitter. I am just emailing to ask is anyone else on the App engine experiencing problems connecting to Twitter? I have test some of my other sites that use urllib and all appear to be able to make successful connections to other sites: such as yahoo etc. Paul --~--~-~--~~~---~--~~ 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: Url Fetch
Some restrictions is made to the urllib running in app engine due to security reasons. eg. urllib.fetch() is restricted to common HTTP ports like 80 and 443. On May 14, 5:47 pm, Paul Kinlan paul.kin...@gmail.com wrote: Hi Guys, My Sitewww.twollo.comis having some issues connection to Twitter. I am just emailing to ask is anyone else on the App engine experiencing problems connecting to Twitter? I have test some of my other sites that use urllib and all appear to be able to make successful connections to other sites: such as yahoo etc. Paul --~--~-~--~~~---~--~~ 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: Neat URLs for developing multiple applications on same development machine
This is an alternative: VirtualHost *:80 ServerName myapp1 RewriteEngine On RewriteRule ^/(.*) http://localhost:8080/$1 [P,L] /VirtualHost VirtualHost *:80 ServerName myapp2 RewriteEngine On RewriteRule ^/(.*) http://localhost:8081/$1 [P,L] /VirtualHost Also works with Google Secure Data Connector (SDC) to use alternative ports on local services instead of only port 80 or 443. /Emil Kjer On May 14, 12:58 pm, kRON filip.dupano...@gmail.com wrote: Thanks, that worked like a charm! On May 13, 11:27 pm, Barry Hunter barrybhun...@googlemail.com wrote: Can you use ProxyPass? Pseudo apache config: VirtualHost ServerName myapp1 ProxyPass /http://localhost:8080/ /VirtualHost VirtualHost ServerName myapp2 ProxyPass /http://localhost:8081/ /VirtualHost On 13/05/2009, kRON filip.dupano...@gmail.com wrote: Dear all, I was wondering if someone could point me in the right direction for creatingneataliases for each application to avoid the URL clashes and clutter in my browser. Ideally, I'd like something likehttp://myapp1/.$tobind to localhost: 8080 andhttp://myapp2/.$tolocalhost:8081. I have Windows 7 RC1 and Apache 2.2. I've created entries in my hosts file for myapp1 and myapp2 to point to 127.0.0.1 and created VirtualHost entries, but the problem is that I'm either left with redirecting or rewriting the URL which, in the end, doesn't mask me from seeinghttp://localhost:8081. Sorry if this isn't the right place to ask, but I'd appreciate any pinpoints! -- Barry -www.nearby.org.uk-www.geograph.org.uk- --~--~-~--~~~---~--~~ 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: google apps how to make a test url...
You can manage your app engine apps via. the dashboard for google apps for your domain. I think it requires you to be an admin of the domain but you can give it a shot at: https://www.google.com/a/cpanel/REPLACE WITH YOUR DOMAIN/Dashboard Or, if you is added as an developer of the project you can visit http://appengine.google.com/a/REPLACE WITH YOUR DOMAIN /Emil Kjer On May 14, 8:31 pm, Aaron shyhockey...@gmail.com wrote: I know that but the company had a previous programmer that made the site. He made some app that will test the site it's for testing purposes. For example the url would be dev.mydomain.com that would be the url where I can go to and check out how the site looks and test the functions of it. It will be live but it's not the offical version just for testing purposes then I would upload it to the app that will use the url:www.mydomain.com Currently the previous programmer dosen't remeber what that app name was. So I am woundering if their is any way I can recover that app name? I mean I know the url. I thought if I send a e-mail to google asking if they can look it up . Cause I am new to google app engine So I am not 100% sure how it works. --~--~-~--~~~---~--~~ 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] How to send authentication requests like u...@password through secure data connector?
I have been creating my own transporter to reach other ports than the common HTTP ports in XMLRPC calls through google Secure Data Connector. It is working fine, but i need to send user authentication with my requests like u...@password: . Do anyone know how to do that? My transporter is: import xmlrpclib import logging from google.appengine.api import urlfetch class MyTransport(xmlrpclib.Transport): #overriding this method is enougth #to put the 'user_intranet' header def request(self, host, handler, request_body, verbose=0): result = None url = 'http://%s%s' % (host, handler) try: response = urlfetch.fetch(url, payload=request_body, method=urlfetch.POST, headers={'use_intranet':'yes'}, follow_redirects=True) except: msg = 'Failed to fetch %s' % url logging.error(msg) raise xmlrpclib.ProtocolError(host + handler, 500, msg, {}) if response.status_code != 200: logging.error('%s returned status code %s' % (url, response.status_code)) raise xmlrpclib.ProtocolError(host + handler, response.status_code, , response.headers) else: result = self.__parse_response(response.content) return result def send_user_agent(self, connection): connection.putheader(User-Agent, self.user_agent) connection.putheader(use_intranet, yes) def __parse_response(self, response_body): p, u = xmlrpclib.getparser(use_datetime=False) p.feed(response_body) return u.close() --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---