Skip to content

Instantly share code, notes, and snippets.

@ego008
Created October 1, 2012 10:22
Show Gist options
  • Save ego008/3810745 to your computer and use it in GitHub Desktop.
Save ego008/3810745 to your computer and use it in GitHub Desktop.
def get_newest():
nid_obj = Counter.get_or_insert('node_auto_increment', name='node_auto_increment', value = 1)
from_id = nid_obj.value - 1
to_id = from_id - 10
if to_id<0:
to_id = 0
objs = []
n_objs = Node.get_by_id([id for id in range(from_id, to_id, -1)])
for n_obj in n_objs:
if n_obj:
objs.append(('n-'+str(n_obj.key().id()), n_obj.name))
return objs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment