Google Groups

Re: Announcing Satchmobile


Chris Moffitt Nov 14, 2011 6:40 PM
Posted in group: Satchmo developers
Stuart,

The answer is yes, I would be interested but the biggest challenge is maintaining it going forward. I personally haven't done a lot of mobile development so I'm not sure what it will take to maintain.

I guess what I'm saying is that I want to make sure there's broad interest and willingness to support. Assuming those two conditions are met, then, yes I would be interested in incorporating.

-Chris

On Mon, Nov 14, 2011 at 4:15 PM, Stuart <stu...@bistrotech.net> wrote:
Marc, thanks for the feedback and the code!

Regarding the overall issue I was trying to work out, please allow me
to rephrase the question. Would the satchmo devs want to include in
satchmo an app that provides services for mobile apps? For the sake of
this conversation, please assume that the app is of sufficient quality
-- I am not looking for a guarantee or anything. Basically I don't
want to waste my time integrating directly with Satchmo if there is no
interest in ever bringing it into the trunk. In that case I would keep
my app its own separate repository, rather than in a forked satchmo
repo, and manage the system boundary differently.

I hope what I am asking makes sense. Some feedback from the main devs
(Chris? Hynek?) would be greatly appreciated.


Thanks!

--Stuart

On Nov 9, 4:47 am, "Dierckx, Marc" <Marc.Dier...@messergroup.com>
wrote:
> Hello,
>
> I have implemented webservices on my shop, based on a snippet from the internet with soaplib (hereunder the skeleton). I also have a mobile version (raw hack) of the shop based on dojo mobile. It however keeps the logic of Satchmo
>
> regards,
>
> marc
>
> import StringIO
> import base64
> from soaplib.serializers.primitive import Boolean, String
> from soaplib.service import DefinitionBase, rpc
> from soaplib.wsgi import Application
> from django.conf import settings
> from settings import PROJECT_DIR
>
> from django.http import HttpResponse
>
> def extract_basic_credentials(request):
>     """Extact authorization basic credentials from request"""
>     username, password = None, None
>     if 'HTTP_AUTHORIZATION' in request.META:
>         auth = request.META['HTTP_AUTHORIZATION'].split()
>         if len(auth) == 2:
>             if auth[0].lower() == "basic":
>                 username, password = base64.b64decode(auth[1]).split(':')
>     return username, password
>
> class Http401(Exception):
>     pass
>
> class Http403(Exception):
>     pass
>
> class DumbStringIO(StringIO.StringIO):
>     def read(self, n):
>         return self.getvalue()
>
> # the class which acts as a wrapper between soaplib WSGI functionality and Django
> class DjangoSoapApp(Application):
>
>     def authenticate(self, request):
>         """Authenticate webservice request."""
>         ws_username = getattr(settings, 'WS_USERNAME', None)
>         if ws_username:
>             ws_password = getattr(settings, 'WS_PASSWORD', None)
>             username, password = extract_basic_credentials(request)
>             if username == None:
>                 raise Http401("401 Authentication required.")
>             if username != ws_username or password != ws_password:
>                 raise Http403("403 You're not authorized to use this webservice!")
>
>     def __call__(self, request):
>         # wrap the soaplib response into a Django response object
>         #self.authenticate(request)g
>         django_response = HttpResponse()
>
>         def start_response(status, headers):
>
>             status, reason = status.split(' ', 1)
>             django_response.status_code = int(status)
>             for header, value in headers:
>                 django_response[header] = value
>
>         environ = request.META.copy()
>         environ['CONTENT_LENGTH'] = len(request.raw_post_data)
>         environ['wsgi.input'] = DumbStringIO(request.raw_post_data)
>         environ['wsgi.multithread'] = False
>
>         response = super(DjangoSoapApp, self).__call__(environ, start_response)
>         django_response.content = '\n'.join(response)
>
>         if django_response.status_code == 405:
>             return HttpResponse("405 Method not allowed for this webservice.",
>                 'text/plain', status=405)
>         return django_response
>
> from soaplib_handler import DjangoSoapApp
> from soaplib.serializers.primitive import Boolean, String, Integer
> from soaplib.serializers.clazz import Array
> from soaplib.service import DefinitionBase, rpc
> from soaplib.wsgi import Application
>
> from django.utils import simplejson
> from django.core import serializers
> import logging
>
> log = logging.getLogger()
>
> # the class with actual web methods
> class MesserShopService(DefinitionBase):
>
>     __tns__ = 'http://localhost:8000/webservice/liferay'
>
>     @rpc( String, String, String,  _returns=String)
>     def Product(self,language, products):
>
>        ----  retrieve the  --- models you want
>
>         return proposals
>
> my_Liferay = DjangoSoapApp([MesserShopService], MesserShopService.__tns__)
>
>
>
>
>
>
>
> -----Original Message-----
> From: satchmo-d...@googlegroups.com on behalf of Stuart Laughlin
> Sent: Tue 08.11.2011 22:30
> To: satchmo-d...@googlegroups.com
> Subject: Announcing Satchmobile
>
> Hello Everyone --
>
> I have begun work on a django app called satchmobile [1]. It is
> essentially a set of web services that expose satchmo data in json
> format. At this point it is very nascent and a bit hackish, but not
> for long (Lord willing). I am using these services to create some
> mobile apps for both android and iOS (i.e. iphone / ipad). The mobile
> apps will likely remain closed-source, but I plan to contribute the
> web services application back to the community.
>
> Has the idea of satchmo web services been considered / discussed here
> before? (The list archives seem to indicate no.) Is there any interest
> in having these services included as an app within the satchmo project
> itself? Basically I am trying to decide whether to fork/branch satchmo
> and develop satchmobile as an app there, or to continue as I have
> begun, with the web services in a project completely separate from
> (although dependent upon) satchmo.
>
> Any insight / feedback greatly appreciated!
>
> 1:https://bitbucket.org/sclaughl/satchmobile
>
> --Stuart
>
> --
> You received this message because you are subscribed to the Google Groups "Satchmo developers" group.
> To post to this group, send email to satchmo-d...@googlegroups.com.
> To unsubscribe from this group, send email to satchmo-developers+unsubscribe@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/satchmo-developers?hl=en.
>
>
>
>  winmail.dat
> 6KViewDownload

--
You received this message because you are subscribed to the Google Groups "Satchmo developers" group.
To post to this group, send email to satchmo-d...@googlegroups.com.
To unsubscribe from this group, send email to satchmo-developers+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/satchmo-developers?hl=en.