Re: Learning Python

2005-10-11 Thread Chris Dewin
On Mon, 10 Oct 2005 17:20:35 +, dannypatterso wrote:

[snip]

>> I'm a hobby programmer using mostly BASIC(s) and some Java.  I know
>> procedural programming and I know what encapsulation, inheritance and
>> polymorphism are but I have very little experience in using them as
>> I've written just a few Java programs (i.e., I guess I could use a
>> primer in OO programming).

There was an excellent such primer on devshed, by Icarus, but they appear
to have taken it down.

I saved a copy of it to my HD. Would there be anything morally, or legally
wrong with me uploading it to my site?

-- 
www.wintergreen.in

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help-log in to a web page

2005-10-06 Thread Chris Dewin
On Thu, 06 Oct 2005 14:51:31 +0530, Murugesh wrote:

>  id="username" class="x4" onkeypress="return
> _submitOnEnter(event, 'User');" name="j_username" size="30"
> type="text" value="myadmin">

I'm a novice too. But that looks to me like a javascript method. At a
guess, it probably re directs the browser to some web script which checks
the password.

If so, knowing the address of that script, and the names of the keys it's
expecting would be useful to you. They might be in the 
section of the page. If not, they might be contained in a *.js file
somewhere.

I have no idea whether this helpful at all. Just consider it speculation.
-- 
www.wintergreen.in

-- 
http://mail.python.org/mailman/listinfo/python-list


Question about smtplib, and mail servers in general.

2005-09-20 Thread Chris Dewin
Hi. I've been thinking about using smtplib to run a mailing list from my 
website.

s = smtplib.SMTP("server")
s.sendmail(fromaddress, toaddresess, msg)

I know that in this instance, the toaddresses variable can be a variable
of type list.

Suppose the list contains well over 100 emails. Would that create some
sort of drain on the mail server? Would I be better off doing it in some
other way? 

-- 
www.wintergreen.in

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Uploading images via cgi?

2005-08-30 Thread Chris Dewin
On Tue, 30 Aug 2005 21:55:26 +, Peter Hansen wrote:

> Chris Dewin wrote:
>> How do I go about writing a cgi script, that will enable the client to
>> upload things to a directory on my website?
>> 
>> I would also like to write a script that enables the client to delete
>> items in that directory if they want. Given that it's unix server, how
>> do I go about ensuring the files are written to that dir with the right
>> permissions?
> 
> What did you learn when you tried a few of the more obvious searches
> with Google (including the word "python" in the search)?  You must have
> learned _something_ but still have questions, so please tell us what you
> already know so we can skip over the easy stuff.
> 
> Knowing what you've already discovered will avoid having everyone here
> repeat all the same answers (which you can easily find in the Google
> Groups archives) to what is a fairly common sort of question.
> 
> -Peter

Very well then. I did search google, and found a number of python scripts
that already do the job (more or less). But when I try to tweak them to my
specifications, I get errors ... probably because I don't really
understand how the process of uploading a file via a webform to a cgi
works.

For e.g, take the script at this url.

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/273844

By reading through this script, I know that simply putting '' in your web form will establish a connection
to the cgi when the client submits the form. The python interpreter
obviously sustains that connection while the file is being transferred,
the file being part of the FieldStorage() instance. But then, the script
saves the file to the disk in some special way I don't understand. In this
case:

>fout = file (os.path.join(upload_dir, fileitem.filename), 'wb') while
>1:
>chunk = fileitem.file.read(10)
>if not chunk: break
>fout.write (chunk)
>fout.close()

chunk = fileitem.file.read(10), and fout.write (chunk) seem to be the
key statements. Could  someone elaborate on these for me please? And why
do they need to be in a while loop?
-- 
http://mail.python.org/mailman/listinfo/python-list


Uploading images via cgi?

2005-08-30 Thread Chris Dewin
How do I go about writing a cgi script, that will enable the client to
upload things to a directory on my website?

I would also like to write a script that enables the client to delete
items in that directory if they want. Given that it's unix server, how do
I go about ensuring the files are written to that dir with the right
permissions?
-- 
http://mail.python.org/mailman/listinfo/python-list


python image thumbnail generator?

2005-08-27 Thread Chris Dewin
Hi. I run a website for my band, and the other guys want an image gallery.

I'm thinking it would be nice and easy, if we could just upload a jpg into
a dir called "gallery/". When the client clicks the "gallery" link, a 
cgi script could search the gallery/ dir, and create thumbnails of any
jpeg images that don't already have a thumbnail associated with them. The
script could then generate a page of clickable thumbnails.

A few questions:

(1) Can this be done with python? If so, what module do I need to look up?

(2) If it can't be done with python, is there some small utility that will
do it for me? Something I could easily install locally in my own
"public_html" dir on my website?

(3) Is this the sort of thing which, if done regularly, would hog far far
too much of my webhosts system resources?

(4) Am I talking about re inventing the wheel?

-- 
http://mail.python.org/mailman/listinfo/python-list