Форум сайта python.su
class Field(models.Model):
...
for_personal = models.BooleanField(u'Только для персонала',default=False)
class Answer(models.Model):
user = models.ForeignKey(UserAnswer)
field = models.ForeignKey(Field)#,limit_choices_to={'for_personal':True,},)
data = models.TextField(u'Текст')
class UserAnswer(models.Model):
...
class AnswerInline(admin.TabularInline):
model=Answer
extra=1
radio_fields = {"field": admin.VERTICAL}
class UserAnswerAdmin(admin.ModelAdmin):
...
inlines = [AnswerInline]
admin.site.register(UserAnswer,UserAnswerAdmin)
media.setCurrentSource(phonon.Phonon.MediaSource(QtCore.QUrl("http://cs4699.vkontakte.ru/u1265589/audio/cd6e79ff1cb7.mp3")))
"[0x7f125c001370] access_http access error: cannot connect to cs4699.vkontakte.ru:80"
cxfreeze start.pyw --target-dir Release --include-modules PyQt4
File "/usr/bin/cxfreeze", line 5, in <module>
main()
File "/usr/lib/python3.1/site-packages/cx_Freeze/main.py", line 188, in main
freezer.Freeze()
File "/usr/lib/python3.1/site-packages/cx_Freeze/freezer.py", line 470, in Freeze
self._FreezeExecutable(executable)
File "/usr/lib/python3.1/site-packages/cx_Freeze/freezer.py", line 140, in _FreezeExecutable
finder = self._GetModuleFinder(exe)
File "/usr/lib/python3.1/site-packages/cx_Freeze/freezer.py", line 295, in _GetModuleFinder
finder.IncludeModule(name)
File "/usr/lib/python3.1/site-packages/cx_Freeze/finder.py", line 503, in IncludeModule
namespace = namespace)
File "/usr/lib/python3.1/site-packages/cx_Freeze/finder.py", line 258, in _ImportModule
raise ImportError("No module named %r" % name)
ImportError: No module named 'PyQt4'
# -*- coding: utf-8 -*-
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from xml.dom.minidom import parseString
import xpath
class TestPage(webapp.RequestHandler):
def get(self):
xml = u'<?xml version="1.0" encoding="utf-8"?><root><p>Вопрос1<p>Ответ1</p></p><p>Вопрос2<p>Ответ2</p></p></root>'
#xml = u'<?xml version="1.0" encoding="utf-8"?><root><p>Qwestion1<p>Answer1</p></p><p>Qwestion2<p>Answer2</p></p></root>'
doc = parseString(xml)
answ = xpath.find(u'/root/p[contains(., "Вопрос1")]/p', doc)[0].childNodes[0].nodeValue
#answ = xpath.find(u'/root/p[contains(., "Qwestion1")]/p', doc)[0].childNodes[0].nodeValue
self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
self.response.out.write('Answ: ')
self.response.out.write(answ)
application = webapp.WSGIApplication([('/', TestPage)], debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
DirectoryIndex index.html
AddCharset UTF-8 .html
AddCharset UTF-8 .py
Options +ExecCGI
AddHandler cgi-script py
<IfModule mod_headers.c>
<Files *.html>
Header add Pragma "no-cache"
Header add Cache-Control "no-cache"
Header unset Vary
</Files>
</IfModule>
/home/username/www/pyib.py in ()
293 psyco.bind(processImage)
294 except:
295 pass
296
297 WSGIServer(pyib).run()
WSGIServer = <class 'fcgi.WSGIServer'>, pyib = <class '__main__.pyib'>, ).run = <unbound method pyib.run>
/home/username/www/fcgi.py in run(self=<fcgi.WSGIServer object>, timeout=1.0)
1085 if r:
1086 try:
1087 clientSock, addr = sock.accept()
1088 except socket.error, e:
1089 if e[0] in (errno.EINTR, errno.EAGAIN):
clientSock undefined, addr undefined, sock = <socket object, fd=4, family=2, type=1, protocol=0>, sock.accept = <built-in method accept of _socket.socket object>
<class 'socket.error'>: [Errno 22] Invalid argument
args = (22, 'Invalid argument')
errno = 22
filename = None
message = ''
strerror = 'Invalid argument'