[Mailman-Developers] GSOC 2015 :Mailman Client written in Javascript

Andrew Stuart andrew.stuart at supercoders.com.au
Fri Mar 6 10:08:46 CET 2015


Hi Abhishek,

If you are going to do this sort of development you will need to become familiar with tools for observing the traffic being sent from the web browser to the web server.

What sort of operating system are you using?

Right clicking in a browser window that you run your JavaScript code in will generally allow you to bring up Firebug or some similar set of developer tools.  There will be a “network” option there somewhere that allows you to see what is being sent between browser and server.  You will be able to observe the request headers at that point.

You should also install curl and become familiar with using it to send requests to the Mailman REST API.  Make sure you have a good look through the curl options because there are lots of helpful options there for looking at headers etc.

If you are using Chrome there is a plugin called postman that allows you to send request to REST API’s.  This is also helpful.

Generally when you are trying to diagnose problems talking to the Mailman REST API you should first use the tools mentioned above to make sure your request is structured properly. Once you are certain you can execute your request properly using one of the tools above, then it is time to try to make your JavaScript code send the same request.  If your code is not working, use Firebug to observe the difference between what you are sending and what you made work using the command line tools.

If you are doing node.js or some other sort of server executed JavaScript you will need another tool for watching the network traffic.  I presume you are running Mailman on a LInux machine. When diagnosing communications between client and server it is helopful on the Linux side to be able to see the network traffic passing to and from the Mailman REST API.  To do so, I use the following Linux command:

sudo ngrep -W byline -d lo port 7001

This assumes your Mailman REST API is running on port 7001 which it probably is not - I don’t know which port you are running it on - you will have to do a "mailman info” command to find out.  

It will take you a while to become familiar with the output of ngrep and see what is being sent, but it is worth the effort as this is the most direct route to solving many problem.

Finally, to solve the current issue that you have with basic authentication against the Mailman REST API you should just search google for +javascript +basic +auth +stackoverflow - surely there must be some good instructions out there somewhere for how to make basic auth work - it should be pretty straightforward.

thanks

as






On 6 Mar 2015, at 7:20 pm, Abhishek Kumar <abhi170893 at gmail.com> wrote:

Hi,

Sorry for the same last 2 mails. Last one was sent accidentally.
Are there any ideas regarding the issues i mentioned in them..? Abhilash..?

On Fri, Mar 6, 2015 at 2:38 AM, Abhishek Kumar <abhi170893 at gmail.com> wrote:

> Hi,
> 
> Thanks Aanand and Abhilash for the help and suggestions. I need further
> assistance:
> 
> I tried to  write the connection class's rough javascript code. It works
> if i bypass the authentication. I have encoded/decoded the authentication
> data correctly ( as seemed from printing them and what python client
> generates through b64encode(auth.encode('utf-8')).decode('utf-8') ). If
> authentication is allowed, the javascript client shows "401,
> Unauthorized. The REST API requires authentication."
> This happens because the request.auth on line 68 in
> src/mailman/rest/root.py  is None (see in this
> <http://bazaar.launchpad.net/~mailman-coders/mailman/3.0/view/head:/src/mailman/rest/root.py> file)
> even when i am passing the authentication data in the http header . However
> there are no issues when i use the python client through shell  and
> everyhing works fine. I was unable to figure out the issue. Any ideas
> regarding what should i do here..? The  js code(uses some nodejs) can be
> seen here <http://pastebin.com/isxPbsNk>.
> 
> Also i need some guidance on what should i do now towards applying for
> this project. Should i go on writing the javascript version by discussing
> it with the community..? And regarding what would go into my proposal, my
> current understanding stands at  mainly writing javascript equivalent of
> everything present in _client.py(mailman client) alongwith documentation
> and tetsting. What more is required to be done in this project..?
> 
> 
> 
> 
> On Thu, Mar 5, 2015 at 12:33 PM, Abhilash Raj <raj.abhilash1 at gmail.com>
> wrote:
> 
>> Hi Abhishek,
>> 
>> On Wednesday 04 March 2015 07:43 PM, Abhishek Kumar wrote:
>>> Hi,
>>> 
>>> I was able to setup the mailman (Core, postorius, mailman.client,
>>> postorius_standalone)  by downloading them individually. Also with
>>> superuser, i can create domains. I have some questions:
>>> 
>>> 1) When i try to create list i get : HTTP Error 500: A server error
>>> occurred. Please contact the administrator
>> 
>> Try to find out what error is raised, check the logs in
>> var/logs/mailman.log . This error is very common due to the absence to
>> postmap command which mailman uses to create postfix maps. Either you
>> can set your mta to nullmta by adding the following in yout mailman.cfg
>> in var/etc/
>> 
>> [mta]
>> incoming: mailman.mta.null.NullMTA
>> outgoing: mailman.mta.null.NullMTA
>> 
>> 
>> or simply install postfix.
>> 
>>> 2) Though i am able to create domain using postorius ui, i am unable to
>> do
>>> it by directly using the mailman.client. The development.rst doc says
>>> "python manage.py mmclient" can be used for the purpose. But after doing
>>> this no client object is created.  I also tried tried the way given
>>> mailmanclient/docs/using.rst
>>> <
>> http://bazaar.launchpad.net/~mailman-coders/mailman.client/trunk/view/head:/src/mailmanclient/docs/using.rst
>>> 
>>> with
>>> port 8001. This creates client , but that object is unable to talk to
>> the
>>> rest server.
>> 
>> Just saying that "object is unable to talk to the rest server" doesn't
>> help. Make a habit of mentioning the complete traceback from logs when
>> you have errors. Do you get a `Mailman API Error`? If yes, check that
>> your mailman is running. If not, start it using `mailman start` command.
>> 
>>> 3) Is what i installed using lp:mailman the mailman core..? and this
>> handles
>>> the rest requests..?
>> 
>> Yes!
>> 
>>> 4) Is there more documentation online other than that available in the
>> doc
>>> folders of the projects..? I searched online but didn't get any
>> developer
>>> type documentation.
>> 
>> No, the same documentation is available on readthedocs in a html format.
>> 
>>> 5) If i make any changes in the code, what's the best way to make them
>>> reflected in the mailman..? run "python setup.py develop" for that
>>> project..?
>> 
>> You don't need to do anything if you ran `python setup.py develop` to
>> set it up first time. If you used `python setup.py install` then you
>> need to run that again to reflect your changes.
>> 
>>> On Wed, Mar 4, 2015 at 2:41 PM, Abhilash Raj <raj.abhilash1 at gmail.com>
>>> wrote:
>>> 
>>>> On Wednesday 04 March 2015 02:01 PM, Abhishek Kumar wrote:
>>>>> Hi,
>>>>> 
>>>>> Using the viurtualenv, i was able to complete the setup guide. But i
>> am
>>>>> required to login at http://localhost:8000/ and there is no option to
>>>>> register. So i logged in using Mozilla persona. But even after that i
>> am
>>>>> not getting any options to create domains and list as described here
>>>> 
>>>> Are you using mailman-bundler? It does not work right now! For
>>>> development you'd have to download and setup each projects (Core,
>>>> postorius, mailman.client, postorius_standalone) from launchpad.
>>>> 
>>>> Also, only superuser is allowed to create domains. You can create one
>> in
>>>> django (postorius_standalone) using the command:
>>>> 
>>>>   $ python manage.py createsuperuser
>>>> 
>>>> Then you have to login as a superuser using the login credentials given
>>>> or through persona.
>>>> 
>>>> --
>>>> thanks,
>>>> Abhilash Raj
>>>> 
>>>> 
>>> 
>>> 
>> 
>> --
>> thanks,
>> Abhilash Raj
>> 
>> 
> 
> 
> --
> Thanks,
> Abhishek Kumar
> 



-- 
Thanks,
Abhishek Kumar
_______________________________________________
Mailman-Developers mailing list
Mailman-Developers at python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: https://mail.python.org/mailman/options/mailman-developers/andrew.stuart%40supercoders.com.au

Security Policy: http://wiki.list.org/x/QIA9



More information about the Mailman-Developers mailing list