[Tutor] classes and functions

2006-06-29 Thread anil maran
how to use classes and functions in python thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - Tutor@python.org http://ma

[Tutor] static variables - lock/semaphore

2006-07-01 Thread anil maran
hi i have a program that is run on a website, and as it is run from a website, it can be called more than once and hence could end up corrupting db/data is there a way to use some sort of semaphore or lock so that it is not accessed simultaneously the problem is it can be done with static variables

[Tutor] help regarding string

2006-07-02 Thread anil maran
please help me format this string from input : 2006-06-16 16:23:27.703000 to output: 2006-06-16 16:23:27 or 2006-06-16 4:23:27 PM thanks a lot __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.co

[Tutor] question about metaclasses

2006-07-12 Thread anil maran
hi pyguruscan you please tell me why we need metaclasses and how to use themthanks a lotAnil Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail Beta.___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] email anonymizing

2006-07-12 Thread anil maran
i m trying to do email anonymizing like cl in a webapp can you suggest how to do itthanks a lot __Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor

Re: [Tutor] email anonymizing

2006-07-12 Thread anil maran
hi i m trying to anonymize emailseverytime someone enters[EMAIL PROTECTED]i want to generate[EMAIL PROTECTED] and use this email in the web application I want to do this in pythoncan you please explain how to do thisthanks a lotBob Gailer <[EMAIL PROTECTED]> wrote: anil maran wrote:> i m

[Tutor] hi

2006-07-13 Thread anil maran
hi you wonderful energetic pygurusi need to send out lot of emails and sms messages from a python programplease let me know if you know of any library like java sms library or possible solutionsi m clueless and lost herethanks a lot Yahoo! Music Unlimited - Access over 1 million songs. Try it fr

Re: [Tutor] email anonymizing

2006-07-13 Thread anil maran
the ano email id and lookup real email id and send out the emaili want to know how to generate[EMAIL PROTECTED] =>  [EMAIL PROTECTED]and then how do i do the translation[EMAIL PROTECTED] => [EMAIL PROTECTED]thanksanilLuke Paireepinart <[EMAIL PROTECTED]> wrote: anil maran wrote:> h

[Tutor] digging more into metaclasses

2006-07-13 Thread anil maran
hi guysare metaclasses like templates in C++thanks for your explanations Sneak preview the all-new Yahoo.com. It's not radically different. Just radically better. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] email anonymizing

2006-07-13 Thread anil maran
wrote:> anil maran wrote:> >> hi i m trying to anonymize emails>> > hi.> >> everytime someone enters>> [EMAIL PROTECTED]>>>> i want to generate>>>> [EMAIL PROTECTED] and use this email in the web application>>>> I want to do

[Tutor] latin-1 to unicode in python

2006-08-02 Thread anil maran
Unicode?im getting this error:invalid byte sequence for encoding "UTF8": 0x92 since the db is not handling latin-1 and is set to use UTF8 how do i handle thisthanks a lot Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.__

[Tutor] how do i get datetime object or time object from updated in rss

2006-08-03 Thread anil maran
How do i convert this string todatetime objectFri, 21 Apr 2006 03:02:17 +Previously I'd been using mxDateTime (which does everything but requires a C extension) to parse e-mail style dates (i.e. the ones used in RSS and changes.xml) but it looks like they're handled by the standard library. htt

[Tutor] hi

2006-08-04 Thread anil maran
i have a textbox in a webformi save it in postgresin postgres, it has several newlines and it is properly displayedwhen i redisplay using cheetahit just displays in a single line and looks uglyis there a simple way to replace newlines with thanks Talk is cheap. Use Yahoo! Messenger to make PC-to

[Tutor] python unicode - help

2006-08-04 Thread anil maran
postgres takes utf8and ie has different encodings, sometimes western, sometimes utf8when someone submits data to the form with different,  there is an error, how do we determine the encoding, automatically convert to utf8 and then feed to postgresthanks a lot See the all-new, redesigned Yahoo.

[Tutor] how to use

2006-08-04 Thread anil maran
list comprehensions to return a dictionarythanks a lot See the all-new, redesigned Yahoo.com. Check it out. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] can some one explain

2006-08-04 Thread anil maran
decorators and why uses them makes it faster than if then else blocks because of decorators using hash structuresi dont understand thisplease help me Do you Yahoo!? Next-gen email? Have it all with the all-new Yahoo! Mail Beta.___ Tutor maillist - T

Re: [Tutor] how to use

2006-08-05 Thread anil maran
ore than one group in a single  page in cheetah, so after displaying the title, i have to now choose the message to display since i have a list of [] of messages i need to index into them so i thought i will make them return a dictionary indexed with URL  which is unique thanks<[EMAIL PROTECTED]>&

[Tutor] Generic functions

2006-08-05 Thread anil maran
i have a hard time understanding, why these are a better idea than if then else structures . Here is the page, that is not clearthanks a lot First Try at Generic FunctionsWiki:First Try at G… Edit Goto Help. First Try at Generic Functions ... However, I have long meant to use his generic functio

[Tutor] help regarding forms...

2006-08-05 Thread anil maran
i did by mistakeand i got an empty page http://localhost/newtodo?category= can one of you guys explain what this is and tell me if this can be usefully used like http://groups.google.com/group/webpy/post?_done=%2Fgroup%2Fwebpy%3F&_... and if Yes how to use this http://localhost/newtod

Re: [Tutor] how to use

2006-08-05 Thread anil maran
display more than one group in a single> page in cheetah,>> so after displaying the title, i have to now choose the message to > display>> since i have a list of [] of messages>> i need to index into them> so i thought i will make them return a dictionary indexed wit

Re: [Tutor] how to use

2006-08-06 Thread anil maran
what does x**x) do?2nd) what is the key for the dictionary, i assume x is the value of the dictionaryJohn Fouhy <[EMAIL PROTECTED]> wrote: On 05/08/06, anil maran <[EMAIL PROTECTED]> wrote:> list comprehensions to return a dictionaryWell, hyou can use the dict function. eg:dict((x,

[Tutor] error, i m unable to find the error for past 1week, this doesnt work, please help me out

2006-08-06 Thread anil maran
You can override the web.internalerror function to have it to do other interesting things. For example, I have infogami send me an email with the full debugerror traceback whenever there's a crash: olderror = web.internalerror def error():     olderror()     import sys, traceback     tb = sy

[Tutor] can you explain string replacement syntax and comma separated statements

2006-08-06 Thread anil maran
    text = """From: the bugman ...@example.com> To: the bugfixer ...@example.com> Subject: bug: %s: %s (%s) Content-Type: multipart/mixed; boundary="here" --here Content-Type: text/plain Content-Disposition: inline %s %s --here Content-Type: text/html; name="bug.ht

[Tutor] sending emails with html attachment

2006-08-07 Thread anil maran
hi guysWhat is the best way to construct an email in python and also attach a html filethe file is not on disk, but should be dynamically constructed in the python scriptthanks a lot __Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protec

[Tutor] searching for a string in a dictionary

2006-08-08 Thread anil maran
all_types:.there is such a listhow do i search for a particular string say teststring in this listi triedif teststring in all_types:if teststring in all_types.type: it doesnt workplease help me out hereshould i use lambda Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great

Re: [Tutor] searching for a string in a dictionary

2006-08-09 Thread anil maran
if teststring in [s['type'] for s in all_types]:                print 'contained'            else:                print 'notcontained'this workedthanks a lot guyspyTutor rocksAlan Gauld wrote: > On 09/08/06, Alan Gauld <[EMAIL PROTECTED]> wrote:>> > all_types:>> > >> > datetime.datetime(2006, 7, 2

[Tutor] html file - construct attach send... email python

2006-08-09 Thread anil maran
What is the best way to construct an email in python and also attach a html filethe html file to be attached is not on disk, but should be dynamically constructed in the python scriptthanks a lot Stay in the know. Pulse on the new Yahoo.com. Check it out. __

Re: [Tutor] searching for a string in a dictionary

2006-08-09 Thread anil maran
doesTypeExist=filter(lambda x: typeofstring in x.type, all_types) if 'teststring' in [s.type for s in all_types]this works which is better in terms of speed???for+in or filter+lambdathanks a lotAlan Gauld <[EMAIL PROTECTED]> wrote: > On 09/08/06, Alan Gauld <[EMAIL PROTECTED]> wrote:>> > all_types:

[Tutor] What techniques should I use to make my code run faster? Informational

2006-08-09 Thread anil maran
What techniques should I use to make my code run faster? Always profile before you optimize for speed. You should always optimize for readability first: it's easier to tune readable code than to read 'optimized' code, especially if the optimizations are not effective. Before usi

Re: [Tutor] What techniques should I use to make my code run faster?Informational

2006-08-09 Thread anil maran
r time?... :-)Thanks for posting,Alan G.- Original Message - From: "anil maran" <[EMAIL PROTECTED]>To: Sent: Wednesday, August 09, 2006 11:16 PMSubject: [Tutor] What techniques should I use to make my code run faster?Informational> What techniques should I use to make

Re: [Tutor] i18n Encoding/Decoding issues

2006-08-10 Thread anil maran
how do u find out original encodingthanksMichael Lange <[EMAIL PROTECTED]> wrote: Hi Jorge,On Thu, 10 Aug 2006 13:32:10 +0100"Jorge De Castro" <[EMAIL PROTECTED]> wrote:(...)> > Using unicode(body, 'latin-1').encode('utf-8') doesn't work either. Besides, > am I the only one to feel that if I want t

[Tutor] how to remove html ags

2006-08-12 Thread anil maran
Human nature is not a machin...for example in the above stirng i want to remove and i triedstr = str.replace('(.*)','')it doesnt workthanks Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.___ Tutor maillis

[Tutor] suggestions for read unread items datastructure

2006-08-13 Thread anil maran
suggestions for read unread items datastructurekeep a list of read and unread itemshi guysi m building an rss reader and i want you suggestions for datastructurefor keeping read and unread list for each usei m assuming it will be very sparsethanks __

Re: [Tutor] suggestions for read unread items datastructure

2006-08-13 Thread anil maran
there is a blogand it associated feed entriesthe blog postswhen someone clicks it i need to maintain read status for itand when it is unclicked i need the unread statusthis needs to be maintianed for a huge number of usrsthanksBob Gailer <[EMAIL PROTECTED]> wrote: anil maran wrote:>>

Re: [Tutor] suggestions for read unread items datastructure

2006-08-13 Thread anil maran
i m sure the users need to maintain their own data, but as a provider we need to store their information right, sessions and cookies work only during their stay in the site, after they exit, im sure they would like to come back to the same info, wont u so i was wondering what is the best way to ma

Re: [Tutor] how to remove html ags

2006-08-14 Thread anil maran
how to do regular expressionsand remove waht is in and also the brackets<>Kent Johnson <[EMAIL PROTECTED]> wrote: anil maran wrote:> Human nature is not a machin... > >> for example in the above stirng>> i want to remove > and Try one of these:http://www.oluyede.

Re: [Tutor] how to remove html ags

2006-08-14 Thread anil maran
hi lukei tried to do this for 2 weeks using the regexpsi couldnt find itand hence i was asking you guysthanksanilLuke Paireepinart <[EMAIL PROTECTED]> wrote: anil maran wrote:> how to do regular expressions> and remove waht is in and also the brackets> <> Talk is cheap. Us

[Tutor] getting and storing favicon.ico

2006-08-15 Thread anil maran
/favicon.icoi want to get the favicon.ico from the URL when a blog is added to the aggregatorand then display the image,this is the usage scenarioPlease let me know how to do this in pythoni m willing to use os.spawnv() and call convert if need bethanks a lot Do you Yahoo!? Everyone is raving

Re: [Tutor] threads and webpy

2006-08-17 Thread anil maran
did u try os.spawnv()to spawn other unix commands[EMAIL PROTECTED] wrote: > Hi!Hi !> I don't know what web.py is.> Is it something you wrote?no, this is a simple webserver, (http://webpy.org/)> You'll have to write multi-threaded code if you want it> to run multiple> threads :)> (Unless, of course,

Re: [Tutor] threads and webpy

2006-08-17 Thread anil maran
hi likeyour post about how to make it listen on one ip and then on two ips isnt this general python, can you please explain how to go about this, this would be very usefulthanks then show us your code and we'll tell youhow to make it into a class that listens on a single IP and how tostart two list

Re: [Tutor] about threads

2006-08-17 Thread anil maran
you can configure lighttpd virtual hosts to spawn new webpy instances for each of your ip addressEmilia can you explain your problem a little more I have spent quite some time using and asking questions abt the problems ur posting...[EMAIL PROTECTED] wrote: Hi all,my question is probably about the

Re: [Tutor] about threads

2006-08-17 Thread anil maran
You'll have to write multi-threaded code if you want it to run multiple threads :)(Unless, of course, Web.py supports threads?)Luke, what is the easiest way to run multithreaded programs from webpyis there a page that has common gotchas and pitfalls for doing the same.Luke Paireepinart <[EMAIL PROT

[Tutor] Low level socket and threading code in python in HUGE websites -

2006-08-17 Thread anil maran
What kind of low-level socket and threading code is necessary for a db intensive site such as yahoo. How do we use it from python? does anyone  have experience using it http://redditblog.blogspot.com/2005/12/on-lisp.html >From moving to python by the founders of reddit Because of the low-leve

[Tutor] server push

2006-08-17 Thread anil maran
Hi guys i was wondering if someone has successfuly used server push for apps such as meebo etc using webpy if so can you share some guidelines on using them I have a continuously running python webserver and a website, if there is a new mail or message, how do i ping and let the website or the u

[Tutor] web application and database caching technique

2006-08-17 Thread anil maran
i m trying to build a webapplication, i need to cache db records as it has become very slow the sql queries and retrivalcan you guys helpe me out in designing cache structures/ hash tables for these cases 1. Scenario One:    * Huge number of reads    * Few writes    * One row accessed from db pe

Re: [Tutor] (no subject)

2006-08-18 Thread anil maran
it is amazing the amount of knowledge that is being disseminated on this group, guido should love it that u guys are doing such a good job, keep it up guys anil --- Kent Johnson <[EMAIL PROTECTED]> wrote: > Amadeo Bellotti wrote: > > hello is there a way if a condition is not met to > restart the

Re: [Tutor] Low level socket and threading code in python in HUGEwebsites -

2006-08-18 Thread anil maran
28M RAM, the server had 512M - and at the time > 128M RAM cost over $400 - 8x16M modules!) > > HTH, > > Alan G. > > - Original Message - > From: "anil maran" <[EMAIL PROTECTED]> > To: > Sent: Thursday, August 17, 2006 10:48 AM > Subject: [T

Re: [Tutor] web application and database caching technique

2006-08-18 Thread anil maran
Postgresql 8 and python 2.4 let me find out how to do the caching on db, thanks if you have other pointers on how to cache db in python pls let me know --- Alan Gauld <[EMAIL PROTECTED]> wrote: > >i m trying to build a webapplication, i need to > cache db records > > as it has become very slow t

[Tutor] Twisted Medusa Athena frameworks

2006-08-18 Thread anil maran
hi guys i m trying to create a simple site, and on certain event triggers the server or python program needs to send out messages to the site. i m tyring to accomplish it using twisted or medusa or Does any one have experience using it or the asyncore module in python please help thanks a ton

[Tutor] editors

2006-08-18 Thread anil maran
what editors do you guys use? emacs vi? xemacs are there any plugins to configure autocomplete, i want something to do good autocomplete such as showing what type of arguments are available etc thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail h

[Tutor] omnicomplete vim python

2006-08-25 Thread anil maran
do u guys know how to enable omnicomplete using vim for python thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - Tutor@p

Re: [Tutor] omnicomplete vim python

2006-08-28 Thread anil maran
i want some form of suggestion or autocompletionso if i sayimport aspelland then typeaspell.i know what are available without running to pyshell or some interpreterand aspell.Dict(should suggest wat are the possible argumentsAlan Gauld <[EMAIL PROTECTED]> wrote: > anil maran wrote:>

[Tutor] encoding text in html

2006-09-13 Thread anil maran
i was trying to display some text it is in utf-8 in postgres and when it is displayed in firefox and ie, it gets displayed as some symols with 4numbers in a box or so even for ' apostrophe please tell me how to display this properly i try title.__str__ or title.__repr__ both dont work___

Re: [Tutor] encoding text in html

2006-09-13 Thread anil maran
submits: We\xe2\x80\x99re pretty surthis is how it is stored in postgresplease help me outthanks- Original Message From: anil maran <[EMAIL PROTECTED]>To: tutor@python.orgSent: Wednesday, September 13, 2006 12:14:10 AMSubject: encoding text in html i was trying to display some text

Re: [Tutor] encoding text in html

2006-09-13 Thread anil maran
「ひぐらしのなく頃に」30秒TVCF風ver.0.1 this is how it is getting displayed in browser- Original Message From: anil maran <[EMAIL PROTECTED]>To: anil maran <[EMAIL PROTECTED]>Sent: Wednesday, September 13, 2006 2:07:55 AMSubject: Re: [Tutor] encoding text in htmlsubmits: We\x

[Tutor] Help with cookies/auth

2006-09-22 Thread anil maran
web.setcookie('user', '', 'Mon, 01-Jan-2000 00:00:00 GMT')  File "", line 1    n-2000 00:00:00 GMT') compare datetime.datetime to int    ^SyntaxError: invalid syntaxIm trying to set a cookie after logging an user in. If someone has somecode for doing this it ll be greatthe code I use for st

[Tutor] UNICODE BEST RESPONSE

2006-09-23 Thread anil maran
Hum, I don't have any problems, and I don't do anything special ... - I use PostgreSQL, so I created my database using UTF-8 encoding. - my Python modules start with "# -*- coding: utf-8 -*-". - all my modules and my templates are utf-8 encoded (I use Vim, so I use ":set encoding=utf-8", but it sh

Re: [Tutor] do you know how to do this

2006-10-12 Thread anil maran
e hashes match. I m unable to figure out how to do this yet Anil- Original Message From: Danny Yoo <[EMAIL PROTECTED]>To: [EMAIL PROTECTED]Cc: Tutor Sent: Thursday, October 12, 2006 10:17:14 AMSubject: do you know how to do this>> Date: Thu, 12 Oct 2006 01:46:44 -0700 (PDT)>> From: an

[Tutor] Help with generating session id

2006-10-12 Thread anil maran
Hi guysI m trying to maintain Sessions for each user, and a session-id that needs to be stored in cookie. I m unable to figure out how to generate session-id that can be stored in a cookie and sync with a session.The problem is this everytime someone logs in check and see if they have session info

[Tutor] Help with sessions

2006-10-15 Thread anil maran
I tried creating sessions for each appand then did htis codedef session_mw(app):    sessionStore = DiskSessionStore(storeDir="%s/sessions/" % os.getcwd(), timeout=5)    sessionStore= sessionStore.createSession()    return SessionMiddleware(sessionStore, app) def initsession(session):    session['id

[Tutor] http://www.google.com/coop/cse?cx=010104417661136834118%3Aat1-hsftvfo

2006-10-25 Thread anil maran
http://www.google.com/coop/cse?cx=010104417661136834118%3Aat1-hsftvfo Anil __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - T

[Tutor] Adding voting to several object in python and db

2006-10-28 Thread anil maran
I m having lots of fun with python it is like all of sudden I munshackled from the days of java Man it is a lot of fun. It is supersimple and easy... Ok now to my question, I m trying to add a rankingfeature to various objects in the system,  the users, their posts,their media etc, suffice to say I

[Tutor] automatically add it to all the classes

2006-10-29 Thread anil maran
All the classes in my webpy application have the following lines is there anyway to automatically add it to all the classes in code.py, user.py If it is too basic, please pardon my naivette. thanks John These are the lines shared by all classes,    @checkaccess(auth=True)         sess = we

[Tutor] Auto-hyperlinking ignoring html tags

2006-11-24 Thread anil maran
Hey I m trying to auto-hyperlink urls, i found libcia.web.Regextransform.py but the problem is it applies auto hyperlink on html tags for eg < img src = " http://www.google.com/a.gif " > becomes *gta* img src=" < a href= "http://www.google.com/a.gif " *lt is there any way to auto-hyperlink on te

[Tutor] Sending email from windows python

2006-12-25 Thread anil maran
Hi guys how do we use sendmail to send mail from windows smtplib works in unix flawlessly thanks Anil __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

[Tutor] index of max value in a list

2006-12-25 Thread anil maran
the max function, it returns the maximum value in the list rather than the index associated with that value. How do I return the index? thanks Anil __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yaho

[Tutor] Session from different app or domain

2007-01-01 Thread anil maran
One app i m developing needs integrating with the client site and get their users, so I need to use their login to log the users in and once they are in they should use my application sort of like Microsoft Passport... Here is the problem the example usage is in Django and they are talking about

[Tutor] Sets in python

2007-01-21 Thread anil maran
http://www.linuxforums.org/programming/introduction_to_python__part_1.html Sets I think I don't really have to explain what a set is, as everyone should know them from mathematics. It's simply a pile of elements that do not have ordering and do not contain duplicates. A set has to be initializ

Re: [Tutor] Best IDE for Python

2007-01-28 Thread anil maran
Vim and emacs are equally good shawn bright <[EMAIL PROTECTED]> wrote: i think pydev ( an eclipse plugin ) can too. shawn On 1/27/07, Dick Moores <[EMAIL PROTECTED]> wrote: At 07:12 PM 1/24/2007, Shadab Sayani wrote: Hi, I am using vim editor to code my project in python.Is there a good IDE

[Tutor] I m trying to understand why we need Co-routines

2007-02-07 Thread anil maran
Hello Yesterday I spoke to an employee of yahoo egroups and he was explaining that they used coroutines to send mails in egroups because each thread was 2mb in size... Can you point me to resources on how to use co-routines in python or if you have code samples it would be great thanks Anil

[Tutor] Geolocating objects

2007-02-10 Thread anil maran
Hello i m trying to use python to find the proximity of a person using lat long gps and zipcodes. I m using python. please point me to resources for this thanks a lot Anil - Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.__