[BangPypers] Compare two htmls for unittest

2015-03-14 Thread Amit Sethi
Hi All , I plan to port my html templates for mail to a new templating engine. So i am setting up some unit tests for that. However I am not sure how do i compare two html strings for equality. There might be places where the strings generated may be different from my test samples but they may rend

Re: [BangPypers] How to dynamically load modules in Django/Python

2014-12-17 Thread Amit Sethi
Mithun a suggestion, checkout how settings.py file is imported in your manage.py Thanks Amit ___ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] Mock json_request unit testing.

2014-06-25 Thread Amit Sethi
Well it will be more clear if you specify what exactly do you need but you can use python mock for your mocking needs in python code https://pypi.python.org/pypi/mock http://www.toptal.com/python/an-introduction-to-mocking-in-python On Wed, Jun 25, 2014 at 9:21 PM, VIMAL K wrote: > I am working

Re: [BangPypers] Restart when python script hangs

2014-06-02 Thread Amit Sethi
If by any chance you are trying to write a deamon, you could monitor it using http://supervisord.org/ On Mon, Jun 2, 2014 at 6:56 PM, Sateesh Kumar wrote: > On Mon, Jun 2, 2014 at 3:14 PM, Rahul Gopan wrote: > >> Hello, >> >> When I run a python script it hangs at random places. Is there any way

Re: [BangPypers] Empty element in xml

2013-11-04 Thread Amit Sethi
> I would not do that at all. There are subtle differences between HTML > and XML, e.g., HTML allows tags that are not explicitly closed with > . Try a sub-element with the or tag. In general, > valid HTML is not necessarily valid XML, and vice versa. The bugs Hmm that is good point. I guess expl

Re: [BangPypers] Empty element in xml

2013-11-04 Thread Amit Sethi
v 4, 2013 at 8:46 AM, Gora Mohanty wrote: > On 4 November 2013 03:00, Amit Sethi wrote: >> >> Hi All, I am stuck with wierd problem . I am dealing with a legacy >> system(written in C) that deals with using some xml. The xml is >> created with python. Now the trouble

[BangPypers] Empty element in xml

2013-11-03 Thread Amit Sethi
Hi All, I am stuck with wierd problem . I am dealing with a legacy system(written in C) that deals with using some xml. The xml is created with python. Now the trouble is that the legacy system understands empty element as: where as using python libs lxml or xml.etree or anything empty element

[BangPypers] Getting a random record from Database . The best strategy.

2013-10-03 Thread Amit Sethi
Hi , I am not sure if this question will be considered sufficiently python related. If its not than I am sorry I will take this somewhere else I am setting up some smoke tests for which I am fetching some records from the db. I am using sqlalchemy for this right now. My real question when fetchi

Re: [BangPypers] File upload to Server using FTP in Django?

2013-09-24 Thread Amit Sethi
By the way for 1. I do not mean you should not use ftp at all but opening a connection syncronously with the request/response flow of your web app may definitely be a bad idea -- A-M-I-T S|S ___ BangPypers mailing list BangPypers@python.org https://ma

Re: [BangPypers] File upload to Server using FTP in Django?

2013-09-24 Thread Amit Sethi
Hi Sameerkatti , First of all , My first recommendation would be not to possibly to do what you are trying to . If you have to an open ftp connection to upload a file in a web application. I am also most certain that there is something wrong in your application by design . 2. Wether you like it o

[BangPypers] Functional testing wih headless browser framework

2013-09-16 Thread Amit Sethi
Hi , I am looking to add some functional testing to my application. I have seen a couple of tools via google search but the reason I am a little circumspect is that last time, I did something similar using selenium and it seemed lack some requirements of mine.(It was not exacty headless) Any tool

Re: [BangPypers] Favorite tips/techniques

2013-09-11 Thread Amit Sethi
1. I do like the accessing dict attributes as keys and specifically where they make more sense as structure by itselfI do use class ABC(object): a = '' def __init__(self, **kwargs): self.__dict__.update(**kwargs) 2. When creating a dictionary of constants create it dynamica

[BangPypers] Running a trigger with sqlalchemy that works with session.execute

2013-05-06 Thread Amit Sethi
Anyone who can help out with sqlalchemy related problem Running a trigger with sqlalchemy that works with session.execute I have a app which using sqlalchemy as the orm. As the app is one in transition some of the update query's run through a session.execute . However I need to create a trigger o

[BangPypers] Unconference and Hackathon

2013-01-15 Thread Amit Sethi
Hi All , We are holding a hackathon on "real time web" in Delhi. Although we say real time web what we really mean a hackathon on anything and everything that excites you about developing for the web. The location and time are given below. All participants will be treated to some amazing and greasy

Re: [BangPypers] Question on Pattern Matching and Regular Expression

2013-01-07 Thread Amit Sethi
On Mon, Jan 7, 2013 at 3:52 PM, davidsnt wrote: > Gora, > > Can you help me with few links that you have handy to which I can refer to > build a parser instead of RE Can you elaborate on the idea of "build a parser" , in any case you will have to use regex. > I also need this app to be >able to

Re: [BangPypers] Any standard way in which i can share contacts

2012-07-24 Thread Amit Sethi
On Tue, Jul 24, 2012 at 10:30 PM, Sriram Karra wrote: > On Tue, Jul 24, 2012 at 7:35 PM, Amit Sethi wrote: > >> Has anybody here worked with phonebook contacts. >> > > Yes, I have. > > Is there a standard which major number of phone manufacturers support >>

[BangPypers] Any standard way in which i can share contacts

2012-07-24 Thread Amit Sethi
Has anybody here worked with phonebook contacts. Is there a standard which major number of phone manufacturers support for electronic business card . Vcard seems to be not supported by Android/blackberry etc .. -- A-M-I-T S|S ___ BangPypers mailing lis

[BangPypers] Heterogeneous forms in django formset

2012-03-12 Thread Amit Sethi
Hi all , I have a certain problem with django forms that seems to me should definitely have a solution already written. I have a couple of different forms that are submitted in the same view something like ...( Sorry just using pseudo code for now ).. class Form1(): #different attri

[BangPypers] Django porting app to multiple databases

2012-03-02 Thread Amit Sethi
Hi all , My app has started breaking after moving to django 1.3 . I don't really understand why? I am working using site framework and given model definition through app_label. The only major change as I can see is that I use UUID Fields rather than AutoField. Now somehow i see that my app is try

Re: [BangPypers] something similar to file command for python

2012-02-29 Thread Amit Sethi
@ Balachandran Sivakumar The name parameter itself is base64 encoded , I did not notice that . I think that solves so many of my problems. Thanks -- A-M-I-T S|S ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listin

Re: [BangPypers] something similar to file command for python

2012-02-29 Thread Amit Sethi
Well interestingly in case of blackberry devices the header is Content-Type: application/octet-stream; name="=?utf-8?B?UFVSQ0hBU0UgT1JERVJfUmVsaWFuY2UuZG9j?=" Content-Disposition: attachment so obviously thats not how it is happening ___ BangPypers mai

Re: [BangPypers] something similar to file command for python

2012-02-29 Thread Amit Sethi
python-magic works like a charm ... However I am still curious as to how other mail servers and clients deducing the name of the original file. Thanks Amit -- A-M-I-T S|S ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman

[BangPypers] something similar to file command for python

2012-02-28 Thread Amit Sethi
Hi All , I am trying to read some file attachments being sent from blackberrys . However blackberry compresses the document into base64 . Now I am able to get the document by converting it back. However I wish to know the file extension of the original document. Now I know file command reads the do

[BangPypers] Https and http difference in behaviour urllib2

2012-02-22 Thread Amit Sethi
Hi all , Can someone explain to me why things are implemented the following in urllib2. When I pass encoded url using http it again encodes the parameters whereas in case of https it does not urlencode again so lets say the (http) call is http//:example.com?email=amit%40sethi.comthe request is h

[BangPypers] Binary blobs inside a mysql data base

2012-01-31 Thread Amit Sethi
Hi all , Is it a good idea to keep binary blobs inside a mysql database . They will not actually be served through http later on. And they are of more than 500 kb usually . I have searched all over stackoverflow and the reactions are mixed . I would like to know what are the views of people on this

[BangPypers] Text/Mail filtering/classification using python

2011-12-23 Thread Amit Sethi
Hi All, I am looking for a spam filtering/classification solution . The essential requirement are : 1. Return a negative on all text with certain words. But apart from returning negative on certain words. I want it to be able to classify certain positives. For ex - Given the fact that [Sachin, C

[BangPypers] Python's stdin buffer size

2011-12-21 Thread Amit Sethi
Hi , I am trying to read in a large message piped to a python script. The message would have something like 1000 words . How can one increase the buffer size of sys.stdin in python. -- A-M-I-T S|S ___ BangPypers mailing list BangPypers@python.org http

Re: [BangPypers] procmail and python

2011-12-21 Thread Amit Sethi
Well I am fairly sure the script is running i am simply writing the message in stdin to a log and that part works fine . Just looking at it again I think its an encoding because in the "gibbrish" message I have found some kind of dkim message thing : "(PST)#012DKIM-Signature: v=1; a=rsa-sha256; c=

Re: [BangPypers] procmail and python

2011-12-21 Thread Amit Sethi
I think I should mention that i am fetching mail from gmail. Is there an encryption that google uses . Also the mails are being received fine on mutt. -- A-M-I-T S|S ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinf

[BangPypers] procmail and python

2011-12-21 Thread Amit Sethi
Has anybody here used some kind of python script with procmail . I want to set up a script that looks at a certain words in a mail and forwards it to users. However I am not able to understand how can I read the message in python script. The documentation suggests something like this should send t

Re: [BangPypers] UML diagrams from python source code

2011-12-15 Thread Amit Sethi
Try Lumpy a reverse engineering tool for python. http://allendowney.com/swampy/lumpy.html -- A-M-I-T S|S ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] seantis questionnaire - Django App

2011-11-23 Thread Amit Sethi
Hi Asif , Sorry if the message seems harsh in any way. As has been pointed to you earlier on the thread it is unlikely that people will know about an obscure django app. It is unlikely that even one of the developers will be able to give a direct "support question" kind of an answer. You will have

[BangPypers] Using Facebook graph api in a page tab application

2011-10-03 Thread Amit Sethi
Hi all , I have a feeling that the answer to this might be very simple but some how i am not able to find it even after reading and re-reading the facebook documentation This is somewhat of generic problem and may not necessarily have a python solution. This is a page tab application running insi

[BangPypers] setuptools and distutils confusion

2011-08-23 Thread Amit Sethi
Hi all, I am really confused as to how setuptools and distutils work. Basically what i want to achieve is be able to install packages in my local environment and not globally ( just a preference ) . I know I can use virtualenv and distribute but i just want to do some simple testing and don't reall

Re: [BangPypers] two dropdowns dependents on each other

2011-08-16 Thread Amit Sethi
[..] > without ajax: > > 1. override __init__ on your modelform, pass the value of the first > dropdown to __init__ and populate the second dropdown depending on that > value. If the value is None, the second dropdown will not be populated. > > 2. in your template, refresh the page when the value o

Re: [BangPypers] [Error] AttributeError: Document instance has no attribute

2011-08-05 Thread Amit Sethi
On Fri, Aug 5, 2011 at 3:48 PM, Subhodip Biswas wrote: > Hi all, > > I am using suds as a WSDL Consumption client. I get proper response in > suds.sax.document format. I am not exactly sure what you are trying to do but isn't sax supposed to be read on the fly , I do not think toxml,tostring etc

[BangPypers] Reseting contenttype for dumpdata/loaddata

2011-07-19 Thread Amit Sethi
Hi All, I am having trouble loading Django fixtures into my database because of contenttypes conflicts. Some of the data i need has foreignkey elements in the contenttypes model. Apparently the problem is that django dynamically tries to populate the content-types table. But if we put data into t

Re: [BangPypers] [Small Hitch]Minidom and xml parsing.

2011-07-12 Thread Amit Sethi
[..] >> I am fairly new to python and i am stuck with a problem. >> What I am  trying to do is parse a xml file using minidom. My xml file >> as almost a structure like this : >> >> >>       >>               >>               >>               >>               >>       >>       >>       >> Not kno

Re: [BangPypers] Writing extendable django views

2011-07-07 Thread Amit Sethi
> I am not sure whether i understood your Q right. The context is just a dict > - why not keep adding to it? Yes I understand that however I was basically I was asking if there is a standard followed or should there be a standard followed to do something like that more especially if you are writing

[BangPypers] Writing extendable django views

2011-07-06 Thread Amit Sethi
Hi all , This is just a thought The question is very abstract , how do you write extendable django views . In particular while working on a certain problem . I realized that i was changing my views just to add certain context variables to the standard views provided by an external django app. I w

[BangPypers] Error loading fixtures after adding a contenttype relation

2011-06-13 Thread Amit Sethi
Hi all , While doing some experiments to extend some features of my project . I added an app and tried to create a generic relation using the contenttype framework as described here https://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/ However when run syncdb again . The fixtures fail

[BangPypers] Using south for migration for a django project

2011-05-19 Thread Amit Sethi
Hi all , I have been trying to use south(0.7) for migrating a django(1.2.5) project (db backend - postgres but have also tried using with sqlite3) Essentially I wish to rename a field in one of my apps. I am also using mezzanine cms (0.10) . The first problem I run into is that mezzanine apps bec

[BangPypers] Broken pipe error

2011-04-14 Thread Amit Sethi
Many times on making request to a the django development server I get this error File "/usr/lib/python2.6/socket.py", line 286, in flush self._sock.sendall(buffer) error: [Errno 32] Broken pipe However usually it is momentary. But I have been getting this error continuously. Thus I am curiou

Re: [BangPypers] Fwd: Help with Python IDE's

2011-03-28 Thread Amit Sethi
I think you might be looking for pydev for eclipse http://pydev.blogspot.com/2006/09/configuring-pydev-to-work-with-django.html On emacs you could use python-mode for autocomplete and https://github.com/gregnewman/django-mode if you want snippets, the later is based on yasnippet.

Re: [BangPypers] Python for mobile apps Deveopment

2011-01-25 Thread Amit Sethi
On Tue, Jan 25, 2011 at 1:57 PM, Neha Jain wrote: > There are many apps written for the maemo platform in pyqt, these are > portable to android and iphone(may be with a bit of difficulty). I am not too sure about that. The architecture of the three platforms is quite different however it is easie

Re: [BangPypers] How to do RSA encryption in python

2010-11-30 Thread Amit Sethi
On Wed, Dec 1, 2010 at 12:30 PM, sarath babu wrote: > Dear all, > I am searching for doing rsa encryption in python. Please give me a method > to do RSA key generation, encryption and decryption. > I think you might like to look at pycrypto[1] or sagemath[2] . There is also a toy rsa example using

[BangPypers] regex euivalent of literal block in Rest Document structure

2010-11-28 Thread Amit Sethi
Hi all, Can somebody tell me what is the regex equivalent of literal block of reST. After a bit of google search.I could get something like r'::\n\n(\s+.+)+\n' but it does not seem to be right. -- A-M-I-T S|S ___ BangPypers mailing list BangPypers@pyth

Re: [BangPypers] Hello:

2009-11-08 Thread Amit Sethi
I don't exactly understand what you mean by code checker? but if you require some thing that can do context free grammar conversion you can use nltk. -- A-M-I-T S|S ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listin

Re: [BangPypers] python zlib problem

2009-10-31 Thread Amit Sethi
That is a very dangerous option ... tried it but uninstalls a lot of packages practically the whole ubuntu-desktop. On Sat, Oct 31, 2009 at 12:25 PM, Kenneth Gonsalves wrote: > On Saturday 31 Oct 2009 12:24:24 pm Amit Sethi wrote: > > How do you force install a package ?? I have tries d

Re: [BangPypers] python zlib problem

2009-10-30 Thread Amit Sethi
How do you force install a package ?? I have tries doing sudo apt-get --force-yes install python and it has no effects.. -- A-M-I-T S|S ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

[BangPypers] python zlib problem

2009-10-30 Thread Amit Sethi
Hi , For some unknown reason , a bug or a screw up I did myself their is no python-zlib which is supposed to be in standard library(python2.6 on ubuntu jaunty).What is the best way to install this in a non-obtrusive way .Its a very important as many packages refer to this and also python-setuptool

[BangPypers] How to search a word list very fast

2009-10-29 Thread Amit Sethi
Hi, I am trying to develop a sort of keyword generator for blog posts much like the Yahoo Keyword service . As an initial idea I am using the list of most used 3000 words in project Gutenberg as being redundant . My question is what is the best way to organize my data and what algorithms would allo