Sha256: 82a79ff986abdca21f29f38bc4dd8451461027b6128c69c7cdb2ac9afa159fab

Contents?: true

Size: 1009 Bytes

Versions: 3

Compression:

Stored size: 1009 Bytes

Contents

import restful
import logging

from google.appengine.ext import webapp
from google.appengine.api import users
from google.appengine.ext import db
from app.models import assist, <%= file_name %>

class Controller(restful.Controller):
  def get(self):
    restful.send_successful_response(self, assist.all(<%= file_name %>.<%= class_name %>))
    
  @restful.methods_via_query_allowed
  def post(self):
    model = <%= file_name %>.<%= class_name %>()
    assist.update_model_from_params(model, self.request.params)
    restful.send_successful_response(self, model.to_xml())
    
  def put(self):
    model = <%= file_name %>.<%= class_name %>.get_or_insert(db.Key(restful.get_model_key(self)))
    assist.update_model_from_params(model, self.request.params)
    restful.send_successful_response(self, model.to_xml())
    
  def delete(self):
    model = <%= file_name %>.<%= class_name %>.get(db.Key(restful.get_model_key(self)))
    db.delete(model)
    restful.send_successful_response(self, model.to_xml())

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
dima-restfulx-1.2.0 generators/rx_scaffold/templates/controller.py.erb
dima-restfulx-1.2.1 generators/rx_scaffold/templates/controller.py.erb
restfulx-1.2.0 generators/rx_scaffold/templates/controller.py.erb