Staredit Network

Staredit Network -> Computers and Technical -> PyForums Production Thread
Report, edit, etc...Posted by RexyRex on 2005-10-12 at 00:50:32
Sessions only work if you have cookies enabled. If they're not, you have to deal with long URLs. sad.gif
Report, edit, etc...Posted by DT_Battlekruser on 2005-10-12 at 00:56:00
You can also register out an IP address. Not entirely sure how to read and set cookies with python.. disgust.gif
Report, edit, etc...Posted by RexyRex on 2005-10-12 at 01:00:41
Yeah, but IP address's aren't always constant.
Therefore the remember me function will not always 'remember' the user.
Report, edit, etc...Posted by DT_Battlekruser on 2005-10-12 at 01:11:24
Better than nothing happy.gif.

And it will work for all users if you just use a remeber-reference IP as a session.
Report, edit, etc...Posted by Doodle77(MM) on 2005-10-12 at 17:50:58
wow... python 2.4.2... was not expecting that, i had 2.3 the whole time pinch.gif
uhh, you know python has a help file right?
heres the important part of the cookie entry
QUOTE(python help)
class BaseCookie( [input])

This class is a dictionary-like object whose keys are strings and whose values are Morsel instances. Note that upon setting a key to a value, the value is first converted to a Morsel containing the key and the value.
If input is given, it is passed to the load() method.


class SimpleCookie( [input])

This class derives from BaseCookie and overrides value_decode() and value_encode() to be the identity and str() respectively.

you could use javascript for the cookies too, you know, i find javascript cookies easier.
you can follow my previous suggestion for temporary storage without cookies.. a hidden form for sessions.

QUOTE
Page Creation Time: 1.59 s

:eww:
well, mabye that wouldnt be so eww if i actually knew sens page creation time
Report, edit, etc...Posted by DT_Battlekruser on 2005-10-12 at 20:31:32
It's very well hidden because it doesn't count the time it takes to load images and such. The time.clock() in the Python script is at the VERY end.

Yeah, I didn't even get around to looking in the Python manual (yes I know it exists). I'm still trying to understand the MIMEHandler class.. crazy.gif
Report, edit, etc...Posted by DT_Battlekruser on 2005-11-08 at 23:13:07
Sorry for a bout of inactivity, but life's life and SEN has been rather involving recently.

UPDATES:
  • Buttons now have graphics for them
  • Edit/Delete are hidden unless you are a global mod or above or it is your post
  • "delete post" works, and subtracts post count too


ADDITION:
More!
  • Edit function
  • Profiles
Report, edit, etc...Posted by DT_Battlekruser on 2005-12-04 at 18:21:32
A primitive registration script is now up. Please don't abuse the fact that it doesn't require an e-mail address to abuse it or I'll have to remove it.

Does anyone go there anymore anyway? sad.gif
Report, edit, etc...Posted by Mini Moose 2707 on 2005-12-04 at 20:07:50
People still code in CGI? tongue.gif
Report, edit, etc...Posted by DT_Battlekruser on 2005-12-04 at 22:13:43
Pfft, I'm a rebel. What can I say?
Report, edit, etc...Posted by Doodle77(MM) on 2005-12-05 at 22:01:25
CODE

DEBUG: Your member ID is  9
DEBUG: Last logged click at Mon December 05, 2005 -- 07:00:27 PM
This page is currently designed to be viewed in Mozilla Firefox 1.0.4 or better in 1024x768 resolution.
--> -->


ExpatError Python 2.3.4: /usr/bin/python2
Mon Dec 5 21:00:28 2005

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

/home/sites/homework/www/public_html/pyforums/index.py
2058         error.prompt(1)
2059     except ValueError:
2060         error.prompt(2)
2061 elif form.has_key('act') and form["act"].value=='logout':
2062     login.logout(logid)
error = <__main__.Error instance>, error.prompt = <bound method Error.prompt of <__main__.Error instance>>

/home/sites/homework/www/public_html/pyforums/index.py in getlast(self=<__main__.Topic instance>, id=1)
 750 class Topic:
 751     def getlast(self,id):
 752         unpack.topic(id)
 753         su_curtopic = data_topic[id]
 754         su_remove = su_curtopic[0]
global unpack = <__main__.Unpack instance>, unpack.topic = <bound method Unpack.topic of <__main__.Unpack instance>>, id = 1

/home/sites/homework/www/public_html/pyforums/index.py in topic(self=<__main__.Unpack instance>, id=1)
 582                 su_y += 1
 583         except TypeError:
 584             print "DEBUG ERROR '1': Topic not found."
 585     def member(self,id):
 586         try:

/home/sites/homework/www/public_html/pyforums/fetch.py in topic(self=<fetch.Get instance>, id=1)
1486             return data
1487         except IOError:
1488             hhhhh = ""
1489
1490 class Write:
hhhhh undefined

/usr/lib/python2.3/site-packages/_xmlplus/dom/ext/reader/Sax.py in FromXmlFile(fileName='data/t1.pdb', ownerDocument=None, validate=0, keepAllWs=0, catName=None, saxHandlerClass=<class xml.dom.ext.reader.Sax.XmlDomGenerator>, parser=None)
 159                            saxHandlerClass, parser)
 160     finally:
 161         fp.close()
 162     return rv
 163
fp = <closed file 'data/t1.pdb', mode 'r'>, fp.close = <built-in method close of file object>

/usr/lib/python2.3/site-packages/_xmlplus/dom/ext/reader/Sax.py in FromXmlStream(stream=<closed file 'data/t1.pdb', mode 'r'>, ownerDocument=None, validate=0, keepAllWs=0, catName=None, saxHandlerClass=<class xml.dom.ext.reader.Sax.XmlDomGenerator>, parser=None)
 141                   catName=None, saxHandlerClass=XmlDomGenerator, parser=None):
 142     reader = Reader(validate, keepAllWs, catName, saxHandlerClass, parser)
 143     return reader.fromStream(stream, ownerDocument)
 144
 145
reader = <xml.dom.ext.reader.Sax.Reader instance>, reader.fromStream = <bound method Reader.fromStream of <xml.dom.ext.reader.Sax.Reader instance>>, stream = <closed file 'data/t1.pdb', mode 'r'>, ownerDocument = None

/usr/lib/python2.3/site-packages/_xmlplus/dom/ext/reader/Sax.py in fromStream(self=<xml.dom.ext.reader.Sax.Reader instance>, stream=<closed file 'data/t1.pdb', mode 'r'>, ownerDocument=None)
 132     def fromStream(self, stream, ownerDocument=None):
 133         self.handler.initState(ownerDoc=ownerDocument)
 134         self.parser.parseFile(stream)
 135         return self.handler.getRootNode()
 136
self = <xml.dom.ext.reader.Sax.Reader instance>, self.parser = <xml.sax.drivers.drv_pyexpat.SAX_expat instance>, self.parser.parseFile = <bound method SAX_expat.parseFile of <xml.sax.drivers.drv_pyexpat.SAX_expat instance>>, stream = <closed file 'data/t1.pdb', mode 'r'>

/usr/lib/python2.3/site-packages/_xmlplus/sax/drivers/drv_pyexpat.py in parseFile(self=<xml.sax.drivers.drv_pyexpat.SAX_expat instance>, fileobj=<closed file 'data/t1.pdb', mode 'r'>, sysID=None)
  66         buf = fileobj.read(16384)
  67         while buf != "":
  68             if self.parser.Parse(buf, 0) != 1:
  69                 self.__report_error()
  70             buf = fileobj.read(16384)
self = <xml.sax.drivers.drv_pyexpat.SAX_expat instance>, self.parser = <pyexpat.xmlparser object>, self.parser.Parse = <built-in method Parse of pyexpat.xmlparser object>, buf = '<topic id="1" title="Testing Thread" subtitle="P...me ="1133838023" editm ="0" editt ="0"/>\n</topic>'

ExpatError: not well-formed (invalid token): line 46, column 156
     args = ('not well-formed (invalid token): line 46, column 156',)
     code = 4
     lineno = 46
     offset = 156

i love doing this crap
put &omg=iomgomsdogmsdgfs in a post. probalby what triggered it.

this would all be solved if you USED FORMS!!!
Report, edit, etc...Posted by DT_Battlekruser on 2005-12-05 at 22:19:39
Apparently "&" crashes the database. < > and " do too, but those are caught by a board error and will eventually be allowed through substitution. Work now?

XML is a sensitive language and will give you error if it doesn't like your syntax.
Report, edit, etc...Posted by Doodle77(MM) on 2005-12-06 at 19:48:38
Doesnt XML have an escape character? because it kinda sucks to not be able to use & anywhere
Report, edit, etc...Posted by DT_Battlekruser on 2005-12-06 at 20:04:33
Even if it doesn't, I can make ASCII substitution PyCodes. For example, XML doesn't tolerate linebreaks, so in the database, a post like

QUOTE
hello

bye


looks like

CODE
hello[br][br]bye


I can do the same thing for crash characters and like [%45], etc. [%45] would be the ascii 45 (in hex).
Report, edit, etc...Posted by Doodle77(MM) on 2005-12-06 at 20:24:36
NICE! profiles work, one suguesstion, the warn log should be in reverse chronological order instead.
Report, edit, etc...Posted by DT_Battlekruser on 2005-12-07 at 00:55:10
Yuck, I hate sorting dry.gif

Will be done sometime.
Report, edit, etc...Posted by Doodle77(MM) on 2005-12-07 at 17:34:41
well, if they are in a list then cant you just sort them backwards by going like:
CODE
for i in range(warnlist.length,0) step -1:
print warnlist[i]

or is it stored as something other than a list.
whatever. im starting to forget python as i learn C++
try to see member #0
CODE
TypeError Python 2.3.4: /usr/bin/python2
Wed Dec 7 16:54:00 2005

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

/home/sites/homework/www/public_html/pyforums/index.py  
2175         error.prompt(2)

2176     except IndexError:

2177         error.prompt(25)

2178 elif form.has_key('goregister'):

2179     try:

error = <__main__.Error instance>, error.prompt = <bound method Error.prompt of <__main__.Error instance>>


/home/sites/homework/www/public_html/pyforums/index.py in view(self=<__main__.Profile instance>, id=0)
 616     <p align="center">"""

 617         if su_mem[7] != "null":

 618             avi = "<img src='"+su_mem[7]+"' alt='Broken Avatar'>"

 619             print avi

 620         else:

avi undefined, su_mem = ['', '', '', '', '', '', '', 0, 0, 0, 0, 0, 0, 0]


TypeError: cannot concatenate 'str' and 'int' objects
     args = ("cannot concatenate 'str' and 'int' objects",)

HA!
Report, edit, etc...Posted by DT_Battlekruser on 2005-12-07 at 19:50:38
I suppose I could do it backwards. It's not hard, just annoying to tuck and sort.

I wrote a homework display page for my old teacher and had to write something that sorted the DB chronologically.
Report, edit, etc...Posted by Doodle77(MM) on 2005-12-08 at 13:44:52
See member #0 , as above.
Report, edit, etc...Posted by DT_Battlekruser on 2005-12-09 at 01:48:30
Later, later. I'm busy.
Report, edit, etc...Posted by Doodle77(MM) on 2005-12-10 at 11:23:20
ouch, youre right, i cant access it right now. thats an evil bug.
Report, edit, etc...Posted by lil_nemesis on 2005-12-31 at 12:43:28
I wouldn't mind joining

Username: lil_nemesis
Password: Email me one lil.nemesis@gmail.com
Report, edit, etc...Posted by DT_Battlekruser on 2005-12-31 at 13:22:11
Registration is active. Click the link in my sig or this first page and then follow the "Register" link.
Report, edit, etc...Posted by Doodle77(MM) on 2006-01-30 at 21:53:40
Sorry, I crashed your DB again.
Report, edit, etc...Posted by DT_Battlekruser on 2006-02-03 at 01:04:28
Quoted from the thread there:

BUGS FIXED
-PyForums does not go down now nightly between 1AM and 2AM server time (EST). This was caused by a late-night reputation updating script running on click between 1AM and 2AM server time running for every member and crashing due to the lack of an MID #13.

-The database crash when using quotation marks, angle brackets, and ampersands is fixed. They are now represented by a pycode like ($xx) (using literal pycode brackets) where xx is the hex-ASCII of the character. All characters in posts should work now.

WHAT'S ON TAP
-Working on shrinking the size of fetch.py and making it easier to edit by condensing blocks of symmetric code.

-A primitive UCP that allows you to control your profile details that appear on the registration panel.

Does anyone care for PyForums anymore?
Next Page (2)