Skip to content
Browse files

Fixed some naming inconsistancies.

  • Loading branch information...
1 parent 99dd2e4 commit e9429b0d557753754aec9ea9ca12c91d71deb03f @gregbayer committed May 11, 2011
Showing with 20 additions and 20 deletions.
  1. +1 −1 app.yaml
  2. +1 −1 index.yaml
  3. +11 −11 livecount/counter.py
  4. +1 −1 livecount/counter_admin.html
  5. +6 −6 livecount/counter_admin.py
View
2 app.yaml
@@ -1,4 +1,4 @@
-application: live-count
+application: livecount
version: 1
runtime: python
api_version: 1
View
2 index.yaml
@@ -1,5 +1,5 @@
indexes:
-- kind: LiveCountCounter
+- kind: LivecountCounter
properties:
- name: namespace
- name: count
View
22 livecount/counter.py
@@ -31,7 +31,7 @@
"""
-class LiveCountCounter(db.Model):
+class LivecountCounter(db.Model):
count = db.IntegerProperty()
namespace = db.StringProperty(default="default")
@@ -45,8 +45,8 @@ def load_and_get_count(name, namespace='default'):
count = memcache.get(name, namespace=namespace)
if count is None:
# See if this counter already exists in the datastore
- key = LiveCountCounter.KeyName(name, namespace)
- record = LiveCountCounter.get_by_key_name(key)
+ key = LivecountCounter.KeyName(name, namespace)
+ record = LivecountCounter.get_by_key_name(key)
count = None
# If counter exists in the datastore, but is not currently in memcache, add it
if record:
@@ -74,8 +74,8 @@ def load_and_increment_counter(name, delta, namespace='default', batch_size=None
if incr_reslt is None:
# See if this counter already exists in the datastore
- key = LiveCountCounter.KeyName(name, namespace)
- record = LiveCountCounter.get_by_key_name(key)
+ key = LivecountCounter.KeyName(name, namespace)
+ record = LivecountCounter.get_by_key_name(key)
if record:
# Load last value from datastore
new_counter_value = record.count + delta
@@ -100,19 +100,19 @@ def load_and_decrement_counter(name, delta, namespace='default', batch_size=None
load_and_increment_counter(name, -delta, namespace, batch_size)
-class LiveCountCounterWorker(webapp.RequestHandler):
+class LivecountCounterWorker(webapp.RequestHandler):
def post(self):
- #logging.info("Running LiveCountCounterWorker...")
+ #logging.info("Running LivecountCounterWorker...")
name = self.request.get('name')
namespace = self.request.get('namespace')
- key = LiveCountCounter.KeyName(name, namespace)
+ key = LivecountCounter.KeyName(name, namespace)
#logging.info("Worker for name = " + name + ", namespace = " + namespace + ", key = " + key)
memcache.delete(name + '_dirty', namespace=namespace)
value = memcache.get(name, namespace=namespace)
if value is None:
- logging.error('LiveCountCounterWorker: Failure for key=%s', key)
+ logging.error('LivecountCounterWorker: Failure for key=%s', key)
return
- LiveCountCounter(key_name=key, count=value, namespace=namespace).put()
+ LivecountCounter(key_name=key, count=value, namespace=namespace).put()
class ClearEntireCacheHandler(webapp.RequestHandler):
@@ -168,7 +168,7 @@ def GetMemcacheStats():
def main():
logging.getLogger().setLevel(logging.DEBUG)
application = webapp.WSGIApplication([
- ('/livecount/worker', LiveCountCounterWorker),
+ ('/livecount/worker', LivecountCounterWorker),
('/livecount/clear_entire_cache', ClearEntireCacheHandler),
('/livecount/writeback_all_counters', WritebackAllCountersHandler),
('/livecount/get_count', GetCountHandler),
View
2 livecount/counter_admin.html
@@ -13,7 +13,7 @@
</form>
- <h2>Top 20 LiveCountCounter Values:</h2>
+ <h2>Top 20 LivecountCounter Values:</h2>
<p>
{% for counter in counters %}
{{ counter.key.name }} = {{ counter.count }}<br>
View
12 livecount/counter_admin.py
@@ -21,7 +21,7 @@
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from livecount import counter
-from livecount.counter import LiveCountCounter
+from livecount.counter import LivecountCounter
import logging
import simplejson
@@ -40,12 +40,12 @@ def get(self):
delta = self.request.get('delta')
if not delta:
delta = 0
- logging.info("getting LiveCountCounters for namespace = " + str(namespace))
+ logging.info("getting LivecountCounters for namespace = " + str(namespace))
modified_counter = None
if counter_name:
- modified_counter = LiveCountCounter.get_by_key_name(namespace + ":" + counter_name)
+ modified_counter = LivecountCounter.get_by_key_name(namespace + ":" + counter_name)
- counter_entities_query = LiveCountCounter.all().filter("namespace = ", namespace).order('-count')
+ counter_entities_query = LivecountCounter.all().filter("namespace = ", namespace).order('-count')
counter_entities = counter_entities_query.fetch(20)
logging.info("counter_entities: " + str(counter_entities))
@@ -99,8 +99,8 @@ def get(self):
self.response.set_status(200)
self.response.out.write(count)
else:
- logging.info("querying datastore for LiveCountCounters for counter_name = " + str(counter_name) + ", namespace = " + str(namespace))
- counter_entities_query = LiveCountCounter.all().order('-count')
+ logging.info("querying datastore for LivecountCounters for counter_name = " + str(counter_name) + ", namespace = " + str(namespace))
+ counter_entities_query = LivecountCounter.all().order('-count')
if counter_name:
counter_entities_query.filter("counter_name = ", counter_name)
if namespace:

0 comments on commit e9429b0

Please sign in to comment.
Something went wrong with that request. Please try again.