Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29220 > unrolled thread
| Started by | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| First post | 2012-09-15 05:22 -0700 |
| Last post | 2012-09-16 01:46 +1000 |
| Articles | 20 on this page of 43 — 5 participants |
Back to article view | Back to comp.lang.python
cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 05:22 -0700
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 05:26 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-15 22:33 +1000
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 06:28 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-15 23:38 +1000
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 06:53 -0700
Re: cannot concatenate 'str' and 'list' objects Peter Otten <__peter__@web.de> - 2012-09-15 16:29 +0200
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 07:51 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 00:55 +1000
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 07:51 -0700
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 06:53 -0700
Re: cannot concatenate 'str' and 'list' objects Roy Smith <roy@panix.com> - 2012-09-15 10:21 -0400
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 07:44 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 00:49 +1000
Re: cannot concatenate 'str' and 'list' objects Roy Smith <roy@panix.com> - 2012-09-15 11:01 -0400
Re: cannot concatenate 'str' and 'list' objects Chris Gonnerman <chris@gonnerman.org> - 2012-09-15 11:09 -0500
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 06:28 -0700
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 07:56 -0700
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 08:01 -0700
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 08:06 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 01:23 +1000
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 08:23 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 01:44 +1000
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 09:04 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 02:25 +1000
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 09:53 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 02:56 +1000
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:22 -0700
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:26 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 03:42 +1000
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:59 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 04:02 +1000
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 11:10 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 09:11 +1000
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 11:10 -0700
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:59 -0700
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:26 -0700
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 10:22 -0700
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 09:53 -0700
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 09:04 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Gonnerman <chris@gonnerman.org> - 2012-09-15 11:13 -0500
Re: cannot concatenate 'str' and 'list' objects Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2012-09-15 08:33 -0700
Re: cannot concatenate 'str' and 'list' objects Chris Angelico <rosuav@gmail.com> - 2012-09-16 01:46 +1000
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-09-16 01:23 +1000 |
| Message-ID | <mailman.756.1347722592.27098.python-list@python.org> |
| In reply to | #29241 |
On Sun, Sep 16, 2012 at 1:06 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote: > Previous webhost has the same flaw as well, look: > > http://www.errorweb.gr/~nikos/cgi-bin/ > > giving away all my scripts. > > Webhost misconfiguration in both hosts! And when I look at the scripts, I see things that do not fill me with confidence. You appear to be reinventing the wheel, and making it hexagonal in the process. That's not to say you shouldn't tinker with wheel design now and then, but as Roy said, the consequences get quite severe once you're hosting a web site to the world. I've been guilty of the same sorts of issues myself. I was poking at some old code today (code that dates back a few years to when I was new to PHP and didn't know of any other way to make a dynamic web site other than CGI) and found some pretty ridiculous coding bloopers. Stuff that didn't stop the site's primary functionality from working, but it sure isn't what I'd call good code. Some day I'll rewrite it all... some day I'll have time available... anyway. Your counter.py appears to be doing what most people do after the fact with log-file analysis. It's usually a lot better to simply parse Apache's log files to find out how many people view your pages, rather than maintaining the statistics. This has a race condition in it: # update existing visitor record if same pin and same host found try: cursor.execute( '''UPDATE visitors SET hits = hits + 1, agent = %s, date = %s WHERE pin = %s AND host = %s''', (agent, date, pin, host)) except MySQLdb.Error, e: print ( "Error %d: %s" % (e.args[0], e.args[1]) ) # insert new visitor record if above update did not affect a row if cursor.rowcount == 0: cursor.execute( '''INSERT INTO visitors(pin, host, hits, agent, date) VALUES(%s, %s, %s, %s, %s)''', (pin, host, 1, agent, date) ) If two page loads simultaneously execute this code, they'll both fail to update, and then both attempt to insert. Also, it's extremely insecure to simply print your database errors. Emit them to a separate log file that only you have access to, and monitor that log while you're developing. Once you're done developing, switch to an alert system if you can, because SQL errors should never occur (obviously don't alert if there are specific errors that you intend to cause and catch). See if you can replace the whole mess of CGI scripts with flat HTML files and AWStats. You'll have much more flexibility in hosting company choice, less risk of security breaches, and much MUCH easier management. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 08:23 -0700 |
| Message-ID | <9c166e95-e70f-4294-833b-1071a24c6d6d@googlegroups.com> |
| In reply to | #29220 |
I swicthed back my code to: f = open( '../' + page ) and http://superhost.gr works which means that line gets parsed correctly. Only when i post data to the text area boxes iam getting the error: cannot concatenate 'str' and 'list' objects how is this possible to work before and NOT work when i enter data to the page for storing to the database?
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-09-16 01:44 +1000 |
| Message-ID | <mailman.757.1347723857.27098.python-list@python.org> |
| In reply to | #29243 |
On Sun, Sep 16, 2012 at 1:23 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote: > I swicthed back my code to: f = open( '../' + page ) > > and http://superhost.gr works which means that line gets parsed correctly. > > Only when i post data to the text area boxes iam getting the error: > > cannot concatenate 'str' and 'list' objects > > how is this possible to work before and NOT work when i enter data to the page for storing to the database? Okay. Putting everything together, I think I can see what's going on. You have a rewrite rule that's changing http://superhost.gr/ into a request that, if my hand-parsing of Apache directives is working, looks like this: http://superhost.gr/cgi-bin/counter.py?page=index.html That page doesn't quite work, as the browser goes looking for images and CSS in cgi-bin instead of the root, but that's pretty much what's going on. (I had to guess that it was index.html, as that part is implicit in the original URL.) You then have a request with a GET variable named 'page', and also a POST variable named 'page', courtesy of the hidden form variable. This would be why you're getting a list instead of a string. Is the hidden form field completely redundant? If so, just remove it. If you need that information for some other reason (eg you want to record which page the user came from), then rename one or other of them. I would recommend a naming convention whereby you keep "internal stuff" away from your main site. For instance, change your rewrite rule to create a form field called _page and have counter.py look for that. Or better still, don't use the query string for that at all, if you can (I can't remember off-hand what a rewrite rule can set, but I think you can carry extra information around in other ways). Currently, your site can be broken by adding a query string to the URL: http://superhost.gr/?page=hahahaha As a general rule, a web site should not get confused by the presence of an unexpected form field. It's not good for someone to be able to break your page like this! It appears that part of the problem is that your getvalue() function has three possibilities, similar to the issue I had a while ago with a similar PHP function. Readers of CS Lewis may recognize what I'm saying... Either she is lying, and there is no array at all; or she is mad - a single item as a scalar instead of an array; or she is telling the truth, and we have an array just like we need. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 09:04 -0700 |
| Message-ID | <65a098bd-4fc7-4df6-9436-3d084b810f22@googlegroups.com> |
| In reply to | #29245 |
I'am not sure what to do and i didnt quite understand what the problem is. Can you please tell me what parts need fixe so for the users to be able to leave remakrs in he text area boxes?
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-09-16 02:25 +1000 |
| Message-ID | <mailman.761.1347726315.27098.python-list@python.org> |
| In reply to | #29247 |
On Sun, Sep 16, 2012 at 2:04 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote: > I'am not sure what to do and i didnt quite understand what the problem is. > > Can you please tell me what parts need fixe so for the users to be able to leave remakrs in he text area boxes? Your question demonstrates a more fundamental issue here, which I'll look at before answering what you actually asked. You're looking to fix your immediate problem and keep moving, without seeking to understand what's actually going on. This means you will, in all probability, bounce from crisis to crisis without ever fixing anything deep underneath; maybe your next issue will be an SQL injection problem, so you'll fiddle with all your database queries, but never connect that to this. The stated purpose of this project is to learn. Learn as much as you possibly can, then, and get a deep understanding of the underlying structure. Use Firebug or the Chrome F12 debug information or something of the sort to watch the requests going back and forth. Leaf through the Apache logs. Print a whole lot of information to the page or to an offline log. And remember, anything you can do, someone else can do just as easily, so with any private information, make sure it's at least protected by a username and password. Now, to answer your question. Actually, I already answered it in my previous post. First, decide whether or not you need the 'page' form field. Either it's redundant or it's necessary. 1) If it's redundant: Easy. Delete it. Your page will begin working again. 2) If it's necessary: Either rename it, or rename the form field you use in your rewrite rule. But spare a thought for the way your script can so easily be broken by simply appending "?page=" to any URL. That's not good, especially given how much internal information gets dumped to the page. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 09:53 -0700 |
| Message-ID | <e2b81b76-03c1-4ebb-a458-678997afe865@googlegroups.com> |
| In reply to | #29251 |
Τη Σάββατο, 15 Σεπτεμβρίου 2012 7:25:15 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: First, decide whether or not you need the 'page' form > > field. Either it's redundant or it's necessary. > > > > 1) If it's redundant: Easy. Delete it. Your page will begin working again. > > 2) If it's necessary: Either rename it, or rename the form field you > > use in your rewrite rule. The 'page' form field is of couse neccessary because how else the python counter.py script would know which html file triggered it so to present it and do its log thing?(i intend to create a few html files) I still do not see why you say that it might be redundant. > But spare a thought for the way your script can so easily be broken by > > simply appending "?page=" to any URL. That's not good, especially > > given how much internal information gets dumped to the page. I tried it, it doesnt load any webistes that way. i.e. http://superhost.gr?page='www.google.gr' fails to load.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-09-16 02:56 +1000 |
| Message-ID | <mailman.764.1347728190.27098.python-list@python.org> |
| In reply to | #29253 |
On Sun, Sep 16, 2012 at 2:53 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote: > The 'page' form field is of couse neccessary because how else the python counter.py script would know which html file triggered it so to present it and do its log thing?(i intend to create a few html files) > > I still do not see why you say that it might be redundant. You create one 'page' value in the form, and another one in the RewriteRule. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 10:22 -0700 |
| Message-ID | <38625eb0-3072-44f8-98db-cf112c1f1159@googlegroups.com> |
| In reply to | #29255 |
Τη Σάββατο, 15 Σεπτεμβρίου 2012 7:56:31 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> On Sun, Sep 16, 2012 at 2:53 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote:
>
> > The 'page' form field is of couse neccessary because how else the python counter.py script would know which html file triggered it so to present it and do its log thing?(i intend to create a few html files)
>
> >
>
> > I still do not see why you say that it might be redundant.
>
>
>
> You create one 'page' value in the form, and another one in the RewriteRule.
i changes the .htaccess to
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/?(.+\.html) /cgi-bin/counter.py?htmlpage=$1 [L,PT,QSA]
but now my webpage presents the error right away.
I dont understand.
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 10:26 -0700 |
| Message-ID | <6d5a37e2-c7f4-440c-bff7-53298a367453@googlegroups.com> |
| In reply to | #29257 |
Τη Σάββατο, 15 Σεπτεμβρίου 2012 8:22:39 μ.μ. UTC+3, ο χρήστης Νικόλαος Κούρας έγραψε:
> Τη Σάββατο, 15 Σεπτεμβρίου 2012 7:56:31 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
>
> > On Sun, Sep 16, 2012 at 2:53 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote:
>
> >
>
> > > The 'page' form field is of couse neccessary because how else the python counter.py script would know which html file triggered it so to present it and do its log thing?(i intend to create a few html files)
>
> >
>
> > >
>
> >
>
> > > I still do not see why you say that it might be redundant.
>
> >
>
> >
>
> >
>
> > You create one 'page' value in the form, and another one in the RewriteRule.
>
>
>
> i changes the .htaccess to
>
>
>
> RewriteEngine On
>
> RewriteCond %{REQUEST_FILENAME} -f
>
> RewriteRule ^/?(.+\.html) /cgi-bin/counter.py?htmlpage=$1 [L,PT,QSA]
>
>
>
> but now my webpage presents the error right away.
>
> I dont understand.
aahhh! alo it needed change to
page = form.getvalue('htmlpage')
now its working! at last!
but can you please tell me what was wrong?
Tha names of the variables was the same both in counter.py and the .htaccess
But why was that confusing?
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-09-16 03:42 +1000 |
| Message-ID | <mailman.769.1347730976.27098.python-list@python.org> |
| In reply to | #29259 |
On Sun, Sep 16, 2012 at 3:26 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote:
> aahhh! alo it needed change to
>
> page = form.getvalue('htmlpage')
>
> now its working! at last!
>
> but can you please tell me what was wrong?
>
> Tha names of the variables was the same both in counter.py and the .htaccess
>
> But why was that confusing?
This is what I'm trying to explain. You need to get to know what's
really happening; what is the rewrite rule doing? I could walk you
through it, there's nothing magical about it, but you really need to
study it for yourself so that you actually understand what's going on.
You've now solved your immediate issue, so you'll probably be tempted
to ignore everything else and move on. And if you're on time pressure,
that's perhaps the right decision. (Five hours and you have a fully
working solution. Not bad for free assistance!) But you still have the
page-breaking issue:
http://superhost.gr/?htmlpage=broken
And there's still the question of whether or not the hidden form field
is needed. I suspect it probably isn't. But these are questions for
you to work out the answers to yourself.
I get an impression from your posts that you're working shallowly, and
probably in some haste. Your posts are somewhat sloppy in spelling and
capitalization; I understand that English probably isn't your first
language, but careful writing is not difficult, and you'll spare
yourself the reputation of sloppy work and sloppy thinking.
It takes time to truly master anything. Whether it's riding a bicycle,
solving Rubik's Cube, or building a web site, you'll need to put in
some hours before you can truly expect to comprehend your work. Trying
to short-cut that usually results in problems down the road. Put in
the time, gain the skill, and you'll reap the rewards!
ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 10:59 -0700 |
| Message-ID | <2992b15f-2ca8-4a67-ad84-c22c06e8bd16@googlegroups.com> |
| In reply to | #29264 |
What hidden form value? you mean page variable does not needed? please clarify. Also i dont know what to do if someone enters a false entry as content for htmlpage.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-09-16 04:02 +1000 |
| Message-ID | <mailman.771.1347732165.27098.python-list@python.org> |
| In reply to | #29265 |
On Sun, Sep 16, 2012 at 3:59 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote: > What hidden form value? > > you mean page variable does not needed? please clarify. > > Also i dont know what to do if someone enters a false entry as content for htmlpage. You have this: <input type="hidden" name="page" value="index.html"> What is that for? Is it needed? ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 11:10 -0700 |
| Message-ID | <8f4cfbe4-862d-4567-969d-b581ab415ea6@googlegroups.com> |
| In reply to | #29267 |
Τη Σάββατο, 15 Σεπτεμβρίου 2012 9:03:00 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: > On Sun, Sep 16, 2012 at 3:59 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote: > > > What hidden form value? > > > > > > you mean page variable does not needed? please clarify. > > > > > > Also i dont know what to do if someone enters a false entry as content for htmlpage. > > > > You have this: > > <input type="hidden" name="page" value="index.html"> > > > > What is that for? Is it needed? > > > > ChrisA ah yes in the index.html page yes...yes i totally forgot about that, that bwas before creating the python counter logging when i was thinking other ways of solving this matter. What about the htmlpage=broken issue? Thanks for helping me with thi for free, i appreciate it a lot.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-09-16 09:11 +1000 |
| Message-ID | <mailman.778.1347750666.27098.python-list@python.org> |
| In reply to | #29268 |
On Sun, Sep 16, 2012 at 4:10 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote: > ah yes in the index.html page yes...yes i totally forgot about that, that bwas before creating the python counter logging when i was thinking other ways of solving this matter. So it's like I was saying, redundant. :) > What about the htmlpage=broken issue? The best fix would be to stop using the querystring to pass information across the rewriterule. Research the Apache directive and learn what you can do with it, and/or research CGI for ways of learning the original URL. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 11:10 -0700 |
| Message-ID | <mailman.772.1347732630.27098.python-list@python.org> |
| In reply to | #29267 |
Τη Σάββατο, 15 Σεπτεμβρίου 2012 9:03:00 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: > On Sun, Sep 16, 2012 at 3:59 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote: > > > What hidden form value? > > > > > > you mean page variable does not needed? please clarify. > > > > > > Also i dont know what to do if someone enters a false entry as content for htmlpage. > > > > You have this: > > <input type="hidden" name="page" value="index.html"> > > > > What is that for? Is it needed? > > > > ChrisA ah yes in the index.html page yes...yes i totally forgot about that, that bwas before creating the python counter logging when i was thinking other ways of solving this matter. What about the htmlpage=broken issue? Thanks for helping me with thi for free, i appreciate it a lot.
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 10:59 -0700 |
| Message-ID | <mailman.770.1347731964.27098.python-list@python.org> |
| In reply to | #29264 |
What hidden form value? you mean page variable does not needed? please clarify. Also i dont know what to do if someone enters a false entry as content for htmlpage.
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 10:26 -0700 |
| Message-ID | <mailman.766.1347729983.27098.python-list@python.org> |
| In reply to | #29257 |
Τη Σάββατο, 15 Σεπτεμβρίου 2012 8:22:39 μ.μ. UTC+3, ο χρήστης Νικόλαος Κούρας έγραψε:
> Τη Σάββατο, 15 Σεπτεμβρίου 2012 7:56:31 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
>
> > On Sun, Sep 16, 2012 at 2:53 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote:
>
> >
>
> > > The 'page' form field is of couse neccessary because how else the python counter.py script would know which html file triggered it so to present it and do its log thing?(i intend to create a few html files)
>
> >
>
> > >
>
> >
>
> > > I still do not see why you say that it might be redundant.
>
> >
>
> >
>
> >
>
> > You create one 'page' value in the form, and another one in the RewriteRule.
>
>
>
> i changes the .htaccess to
>
>
>
> RewriteEngine On
>
> RewriteCond %{REQUEST_FILENAME} -f
>
> RewriteRule ^/?(.+\.html) /cgi-bin/counter.py?htmlpage=$1 [L,PT,QSA]
>
>
>
> but now my webpage presents the error right away.
>
> I dont understand.
aahhh! alo it needed change to
page = form.getvalue('htmlpage')
now its working! at last!
but can you please tell me what was wrong?
Tha names of the variables was the same both in counter.py and the .htaccess
But why was that confusing?
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 10:22 -0700 |
| Message-ID | <mailman.765.1347729768.27098.python-list@python.org> |
| In reply to | #29255 |
Τη Σάββατο, 15 Σεπτεμβρίου 2012 7:56:31 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> On Sun, Sep 16, 2012 at 2:53 AM, Νικόλαος Κούρας <nikos.gr33k@gmail.com> wrote:
>
> > The 'page' form field is of couse neccessary because how else the python counter.py script would know which html file triggered it so to present it and do its log thing?(i intend to create a few html files)
>
> >
>
> > I still do not see why you say that it might be redundant.
>
>
>
> You create one 'page' value in the form, and another one in the RewriteRule.
i changes the .htaccess to
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/?(.+\.html) /cgi-bin/counter.py?htmlpage=$1 [L,PT,QSA]
but now my webpage presents the error right away.
I dont understand.
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 09:53 -0700 |
| Message-ID | <mailman.763.1347728010.27098.python-list@python.org> |
| In reply to | #29251 |
Τη Σάββατο, 15 Σεπτεμβρίου 2012 7:25:15 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε: First, decide whether or not you need the 'page' form > > field. Either it's redundant or it's necessary. > > > > 1) If it's redundant: Easy. Delete it. Your page will begin working again. > > 2) If it's necessary: Either rename it, or rename the form field you > > use in your rewrite rule. The 'page' form field is of couse neccessary because how else the python counter.py script would know which html file triggered it so to present it and do its log thing?(i intend to create a few html files) I still do not see why you say that it might be redundant. > But spare a thought for the way your script can so easily be broken by > > simply appending "?page=" to any URL. That's not good, especially > > given how much internal information gets dumped to the page. I tried it, it doesnt load any webistes that way. i.e. http://superhost.gr?page='www.google.gr' fails to load.
[toc] | [prev] | [next] | [standalone]
| From | Νικόλαος Κούρας <nikos.gr33k@gmail.com> |
|---|---|
| Date | 2012-09-15 09:04 -0700 |
| Message-ID | <mailman.759.1347725069.27098.python-list@python.org> |
| In reply to | #29245 |
I'am not sure what to do and i didnt quite understand what the problem is. Can you please tell me what parts need fixe so for the users to be able to leave remakrs in he text area boxes?
[toc] | [prev] | [next] | [standalone]
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
Back to top | Article view | comp.lang.python
csiph-web