Re: Not clear about the dot notation

2011-01-16 Thread Zeynel
On Jan 16, 3:24 pm, TomF wrote: > vote refers to the Vote instance. So he must have instatiated previously like vote = Vote() is this correct? So I have a model class Item(db.Model): title = db.StringProperty() url = db.StringProperty() date = db.DateTimeProperty(auto_now_add=Tru

Not clear about the dot notation

2011-01-16 Thread Zeynel
What does vote.vote refer to in this snippet? def txn(): quote = Quote.get_by_id(quote_id) vote = Vote.get_by_key_name(key_names = user.email(), parent = quote) if vote is None: vote = Vote(key_name = user.email(), parent = quote) if vote.vote == new

How do I get the email address of the person who clicked the link in the email?

2010-12-04 Thread Zeynel
Hello, I am working with Google App Engine python version. The app sends an email to the user with a link to a page to upload an image as an avatar. It would be nice to have the email so that I can associate the avatar with that email. How can I do this? Thank you. -- http://mail.python.org/mailm

Why datetime module is so complicated?

2010-11-14 Thread Zeynel
It's about a week now I've been trying to convert a datetime object to seconds since epoch; the object is set to current time by class Rep() in Google App Engine: class Rep(db.Model): ... mCOUNT = db.IntegerProperty() mDATE0 = db.DateTimeProperty(auto_now_add=True) mWEIGHT = db.Flo

Re: Is it possible to break a string literal into multiple lines?

2010-11-13 Thread Zeynel
Tim Chase and MRAB: Thanks!! On Nov 13, 2:14 pm, Tim Chase wrote: > On 11/13/2010 12:53 PM, Zeynel wrote: > > > > > > > > > > > I have string formatting line in Google App Engine webframe webapp: > > > self.response.out.write("%

Is it possible to break a string literal into multiple lines?

2010-11-13 Thread Zeynel
I have string formatting line in Google App Engine webframe webapp: self.response.out.write("%s: mWEIGHT: %s mDATE0_integer: %s mCOUNT: %s " % (result.mUNIQUE, result.mWEIGHT, mDATE0_integer, result.mCOUNT,)) I would like to be able to write it as self.response.out.write("%s:

How to read the Python tutorial?

2010-11-10 Thread Zeynel
For instance, when the tutorial has http://docs.python.org/release/2.6/library/datetime.html class datetime.datetime A combination of a date and a time. Attributes: year, month, day, hour, minute, second, microsecond, and tzinfo. What does this mean? How do I use it? For instance, I have a Date

Re: How to read the Python tutorial?

2010-11-10 Thread Zeynel
On Nov 10, 10:51 am, rantingrick wrote: > Wait a minute i am confused...? Does Python have a "text" object that > magically turns into a datetime object? > > >>> mDATE = 2010-11-10 14:35:22.863000 > > SyntaxError: invalid syntax This is the reason I am asking the question. I am confused about wh

How to convert the date object 2010-11-10 14:52:35.026000 to integer?

2010-11-10 Thread Zeynel
mDATE = "2010-11-10 14:52:35.026000" (Not sure if this is string or something else.) I would like to convert mDATE to integer to add, multiply etc. For instance, if I try to convert mDATE to seconds td = mDATE.seconds I get the error td = result.mDATE.seconds AttributeError: 'datetime.dat

Re: Is there a way to pring a list object in Python?

2010-11-08 Thread Zeynel
On Oct 31, 2:44 pm, Benjamin Kaplan wrote: > Rep() = Rep object > Rep.all() = Query object > list(Rep.all()) = List of Rep objects. > list(Rep.all())[0] = A single Rep object > list(Rep.all())[0].replist = A list > Thanks! This was very helpful. -- http://mail.python.org/mailman/listinfo/python

Re: Exception handling with NameError

2010-11-05 Thread Zeynel
On Nov 5, 1:26 pm, Peter Otten <__pete...@web.de> wrote: > Of course I'm only guessing because you don't provide enough context. > > Peter Thanks. This is the problem I am having, in general: K = [] # a container list K = ["A", "B"] ARCHIVE = [] # a list where items from K is archived ARCHIV

Exception handling with NameError

2010-11-05 Thread Zeynel
Hello, I want to append new input to list SESSION_U without erasing its content. I try this: ... try: SESSION_U.append(UNIQUES) except NameError: SESSION_U = [] SESSION_U.append(UNIQUES) ... I would think that at first try I would get the NameEr

Re: Is there a way to pring a list object in Python?

2010-10-31 Thread Zeynel
On Oct 31, 5:52 am, Dave Angel wrote: > On 2:59 PM, Zeynel wrote:> class Rep(db.Model): > >      author = db.UserProperty() > >      replist = db.ListProperty(str) > >      unique = db.ListProperty(str) > >      date = db.DateTimeProperty(auto_now_add=True) >

Re: Is there a way to pring a list object in Python?

2010-10-31 Thread Zeynel
On Oct 31, 3:00 am, Richard Thomas wrote: > On Oct 31, 5:42 am, Zeynel wrote: > > > class Rep(db.Model): > >     author = db.UserProperty() > >     replist = db.ListProperty(str) > >     unique = db.ListProperty(str) > >     date = db.DateTimeProperty(aut

Is there a way to pring a list object in Python?

2010-10-30 Thread Zeynel
class Rep(db.Model): author = db.UserProperty() replist = db.ListProperty(str) unique = db.ListProperty(str) date = db.DateTimeProperty(auto_now_add=True) Rep().replist = L Rep().put() mylist = Rep().all().fetch(10) I am trying to display mylist; but I am getting the object.

Re: Using nested lists and tables

2010-10-28 Thread Zeynel
On Oct 28, 9:35 am, Iain King wrote: > It's equivalent to: > > if columns: >     if columns[-1][0] == s: >         dostuff() > > i.e. check columns is not empty and then check if the last item > startswith 's'. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Using nested lists and tables

2010-10-28 Thread Zeynel
On Oct 28, 2:32 am, robert wrote: > the reason may be that your text doesn't contain a question (mark). ... > perhaps drill down to a question on python-level. Thanks, I realize that what I was trying to ask is not too clear. I am learning to GAE using Python and I want to deploy a simple app. Th

Re: Using nested lists and tables

2010-10-28 Thread Zeynel
On Oct 28, 4:49 am, Peter Otten <__pete...@web.de> wrote: Thank you this is great; but I don't know how to modify this code so that when the user types the string 's' on the form in the app he sees what he is typing. So, this will be in GAE. But I have a couple of other questions, for learning pur

Using nested lists and tables

2010-10-27 Thread Zeynel
I am trying to make this simple app for GAE. I get a string s that user enters in a form. I append that to an empty list L = [] then I test if the last saved string is the same as the new string. If same, I write it on the same column; if not the cursor moves to next column (I was trying to do th

Re: Newbie question about scrapy tutorial

2009-11-21 Thread Zeynel
Now I use EditpadPro and IDLE which appears to be adequate for beginning level. But PyDev looks fun, I'll try it. By the way, I realized that the spider sends the scraped data to the pipelines.py. Now everything is working. On Nov 21, 11:21 am, DreiJane wrote: > Sorry, > > i have no idea what sc

Newbie question about scrapy tutorial

2009-11-20 Thread Zeynel
Hello, I have a question about scrapy tutorial and I put 2 questions in the scrapy group http://groups.google.com/group/scrapy-users/t/d5afae7d88672e02 http://groups.google.com/group/scrapy-users/t/4d52fa8c589a412a but there were no answers. Can anyone here help me? The spider works fine but I c

Re: DeprecationWarning on md5

2009-11-18 Thread Zeynel
Thanks. I tried the suppress it but no success. I need to read the documentation more carefully. But since this is not error, I will ignore them for now. On Nov 18, 9:12 pm, Chris Rebert wrote: > On Wed, Nov 18, 2009 at 5:23 PM, Zeynel wrote: > > Hello, > > > I am a newbie

Re: Beautifulsoup code that is not running

2009-11-18 Thread Zeynel
Yes, it shows as empty string. But I learned about Scrapy and now I am studying the tutorial. I like it better than BeautifulSoup. For beginners it is better, I think. On Nov 18, 11:50 am, Peter Pearson wrote: > On Tue, 17 Nov 2009 14:38:55 -0800 (PST), Zeynel wrote: > > [snip] >

DeprecationWarning on md5

2009-11-18 Thread Zeynel
Hello, I am a newbie both in Scrapy and Python. When I create a project with Scrapy I get these errors: C:\Python26\lib\site-packages\twisted\python\filepath.py:12: DeprecationWarning: the sha module is deprecated; use the hashlib module instead import sha C:\Python26\lib\site-packages\twisted\sp

Beautifulsoup code that is not running

2009-11-17 Thread Zeynel
Hello, Please help with this code suggested in the beautifulsoup group http://groups.google.com/group/beautifulsoup/browse_frm/thread/d288555c6992ceaa >>> from BeautifulSoup import BeautifulSoup >>> soup = BeautifulSoup (file("test.html").read()) >>> title = soup.find('title') >>> titleString =

Re: problem with read() write()

2009-10-31 Thread Zeynel
On Oct 31, 3:11 pm, Terry Reedy wrote: Great, thanks. > Zeynel wrote: > > On Oct 31, 10:40 am, "Alf P. Steinbach" wrote: > > Thanks! This works. But I need to close the file before read and open > > it again with "r", otherwise I get the garbage agai

Re: problem with read() write()

2009-10-31 Thread Zeynel
runcates the file to 0 bytes, while 'r+' opens the > file without truncation." Only place i could find it was in this bug report: http://bugs.python.org/issue5061 > * Zeynel: > > > > > > > On Oct 31, 9:55 am, "Alf P. Steinbach" wrote

Re: problem with read() write()

2009-10-31 Thread Zeynel
On Oct 31, 9:55 am, "Alf P. Steinbach" wrote: > * Zeynel: > > > > > > > On Oct 31, 9:23 am, "Alf P. Steinbach" wrote: > >> * Zeynel: > > >>> Hello, > >>> I've been studying the official tutorial, so far it'

Re: problem with read() write()

2009-10-31 Thread Zeynel
On Oct 31, 9:23 am, "Alf P. Steinbach" wrote: > * Zeynel: > > > > > > > Hello, > > > I've been studying the official tutorial, so far it's been fun, but > > today I ran into a problem with the write(). So, I open the file pw > > a

problem with read() write()

2009-10-31 Thread Zeynel
Hello, I've been studying the official tutorial, so far it's been fun, but today I ran into a problem with the write(). So, I open the file pw and write "hello" and read: f = open("pw", "r+") f.write("hello") f.read() But read() returns a bunch of what looks like meta code: "ont': 1, 'center_in