-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f8ce70
commit 36835b7
Showing
17 changed files
with
1,567 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
application: vaifreteapp | ||
version: 1 | ||
runtime: python27 | ||
api_version: 1 | ||
threadsafe: no | ||
|
||
libraries: | ||
- name: django | ||
version: "1.4" | ||
|
||
builtins: | ||
- django_wsgi: on | ||
|
||
handlers: | ||
|
||
- url: /css | ||
static_dir: css | ||
|
||
- url: /js | ||
static_dir: js | ||
|
||
- url: /images | ||
static_dir: images | ||
|
||
- url: /admin/.* | ||
script: main.py | ||
login: admin | ||
|
||
- url: /app/.* | ||
script: main.py | ||
login: required | ||
|
||
- url: /DeliveryService.* | ||
script: services.py | ||
|
||
- url: .* | ||
script: main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import datetime | ||
import time | ||
import logging | ||
from protorpc import remote | ||
from protorpc import messages | ||
from models import * | ||
|
||
class Delivery(messages.Message): | ||
destination_address = messages.StringField(1, required=True) | ||
dest_lat = messages.StringField(2) | ||
dest_lng = messages.StringField(3) | ||
source_address = messages.StringField(4) | ||
source_lat = messages.StringField(5) | ||
source_lng =messages.StringField(6) | ||
request_user = messages.StringField(7) | ||
|
||
class Deliveries(messages.Message): | ||
deliveries = messages.MessageField(Delivery, 1, repeated=True) | ||
|
||
class GetDeliveriesRequest(messages.Message): | ||
limit = messages.IntegerField(1, default=10) | ||
user = messages.StringField(2) | ||
|
||
class DeliveryService(remote.Service): | ||
@remote.method(GetDeliveriesRequest, Deliveries) | ||
def get_deliveries(self, request): | ||
logging.debug('Received request ' + str(request)) | ||
|
||
query = DeliverFee.all().order('-request_date_time') | ||
|
||
#if request.user: | ||
#query.filter('date <=', when) | ||
|
||
deliveries = [] | ||
for delivery_model in query.fetch(request.limit): | ||
delivery = Delivery(destination_address=delivery_model.destination_address, dest_lat=delivery_model.dest_lat, dest_lng=delivery_model.dest_lng, source_address=delivery_model.source_address, source_lat=delivery_model.source_lat, source_lng=delivery_model.source_lng, request_user=delivery_model.request_user.email()) | ||
deliveries.append(delivery) | ||
|
||
return Deliveries(deliveries=deliveries) |
Oops, something went wrong.