Форум сайта python.su
import MySQLdb
db = MySQLdb.Connect()
cursor = db.cursor()
num = cursor.execute("SELECT user_id, birthday FROM users_info WHERE birthday!='0000-00-00' ORDER BY user_id DESC");
print num;
for rw in cursor.fetchall():
user_id = rw[0];
birthday = rw[1];
print user_id, birthday;
db.close();
# -*- coding: utf-8 -*-
import cookielib, urllib2, urllib, sys
cj = cookielib.CookieJar()
opener = urllib2.build_opener( urllib2.HTTPCookieProcessor(cj) )
request0 = urllib2.Request( 'http://mydomain.com/phpbb0/', None, {"User-Agent": "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8"} )
handle0 = opener.open( request0, urllib.urlencode( {'username' : '*** ','password' : '***'} ) )
data0 = handle0.read()
handle0.close()
file('page.htm', 'w').write( data0 )
scene.timer = QtCore.QTimer()
for i in xrange(MouseCount):
mouse = Mouse()
mouse.setPos(math.sin((i * 6.28) / MouseCount) * 200,
math.cos((i * 6.28) / MouseCount) * 200)
scene.timer.timeout.connect(mouse.timerEvent)
scene.addItem(mouse)
scene.timer.start(1000/33)
def timerEvent(self):
self.speed += (-50 + QtCore.qrand() % 100) / 100.0
dx = math.sin(QtCore.qrand() % (360 * 16)) * 10
self.mouseEyeDirection = [dx / 5, 0.0][QtCore.qAbs(dx / 5) < 1]
self.rotate(dx)
self.setPos(self.mapToParent(0, -(3 + math.sin(self.speed) * 3)))
TypeError at /admin/topmenu/menu/add/
'message' is an invalid keyword argument for this function
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/topmenu/menu/add/
Django Version: 1.2.1
Exception Type: TypeError
Exception Value:
'message' is an invalid keyword argument for this function
Exception Location: /usr/lib/python2.6/site-packages/django/db/models/base.py in __init__, line 341
Python Executable: /usr/bin/python
Python Version: 2.6.5
Python Path: ['/home/werevolff/python/steamnet', '/usr/lib/python2.6/site-packages/django_cms-2.0.2-py2.6.egg', '/usr/lib/python2.6/site-packages/South-0.5-py2.6.egg', '/usr/lib/ooo/basis-link/program', '/usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/PIL', '/usr/lib/python2.6/site-packages/gst-0.10', '/usr/lib/python2.6/site-packages/gtk-2.0', '/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode']
Server time: Чтв, 5 Авг 2010 10:01:00 +1100
Traceback Switch to copy-and-paste view
/usr/lib/python2.6/site-packages/django/core/handlers/base.py in get_response
response = callback(request, *callback_args, **callback_kwargs) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/contrib/admin/options.py in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/utils/decorators.py in _wrapped_view
response = view_func(request, *args, **kwargs) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/views/decorators/cache.py in _wrapped_view_func
response = view_func(request, *args, **kwargs) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/contrib/admin/sites.py in inner
return view(request, *args, **kwargs) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/utils/decorators.py in _wrapper
return decorator(bound_func)(*args, **kwargs) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/utils/decorators.py in _wrapped_view
response = view_func(request, *args, **kwargs) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/utils/decorators.py in bound_func
return func(self, *args2, **kwargs2) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/db/transaction.py in _commit_on_success
res = func(*args, **kw) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/contrib/admin/options.py in add_view
return self.response_add(request, new_object) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/contrib/admin/options.py in response_add
self.message_user(request, msg) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/contrib/admin/options.py in message_user
messages.info(request, message) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/contrib/messages/api.py in info
fail_silently=fail_silently) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/contrib/messages/api.py in add_message
return request.user.message_set.create(message=message) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/db/models/fields/related.py in create
return super(RelatedManager, self).using(db).create(**kwargs) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/db/models/query.py in create
obj = self.model(**kwargs) ...
▶ Local vars
/usr/lib/python2.6/site-packages/django/db/models/base.py in __init__
raise TypeError("'%s' is an invalid keyword argument for this function" % kwargs.keys()[0]) ...
▶ Local vars
#coding:utf8
import gtk, gtk.glade
tabs=[gtk.EventBox()]
labels=[]
buttons=[]
efields=[]
fTabs=gtk.Notebook()
toplace="null"
def press_event(widget,event,key):
global toplace
if key=="tab":
tabs.append(gtk.EventBox())
tabs[-1].add(gtk.Fixed())
tabs[-1].show()
tabs[-1].connect("button_press_event",press_event,"on_fTabs")
tabs[-1].set_events(gtk.gdk.BUTTON_PRESS_MASK)
tabs[-1].set_visible_window(False)
fTabs.append_page(tabs[-1],tab_label=gtk.Label(u"Вкладка%s"%(len(tabs))))
if key=="label":
toplace="label"
if key=="button":
toplace="button"
if key=="efield":
toplace="efield"
if key=="on_fTabs": #здесь происходит добавление объектов
if toplace=="label":
labels.append(gtk.Label(u"Метка%s"%(len(labels))))
event_box=gtk.EventBox()
event_box.add(labels[-1])
event_box.connect("button_press_event",press_event,"elabel")
event_box.set_events(gtk.gdk.BUTTON_PRESS_MASK)
curFixed=fTabs.get_nth_page(fTabs.get_current_page()).get_child()
curFixed.put(event_box,int(event.x),int(event.y))
event_box.show()
labels[-1].show()
toplace="null"
if toplace=="button":
buttons.append(gtk.Button(u"Кнопка%s"%(len(buttons))))
curFixed=fTabs.get_nth_page(fTabs.get_current_page()).get_child()
curFixed.put(buttons[-1],int(event.x),int(event.y))
buttons[-1].connect("button_press_event",press_event,"ebutton")
buttons[-1].show()
toplace="null"
if toplace=="efield":
efields.append(gtk.Entry())
efields[-1].set_max_length(25)
efields[-1].set_text("Поле ввода%s"%(len(efields)))
efields[-1].connect("button_press_event",press_event,"eefield")
curFixed=fTabs.get_nth_page(fTabs.get_current_page()).get_child()
curFixed.put(efields[-1],int(event.x),int(event.y))
efields[-1].show()
toplace="null"
def editor_buttons(main):
efieldBtn=main.get_widget("efieldBtn")
buttonBtn=main.get_widget("buttonBtn")
labelBtn=main.get_widget("labelBtn")
tabBtn=main.get_widget("tabBtn")
efieldBtn.connect("button_press_event",press_event,"efield")
buttonBtn.connect("button_press_event",press_event,"button")
labelBtn.connect("button_press_event",press_event,"label")
tabBtn.connect("button_press_event",press_event,"tab")
def cons(main):
tabs[0].connect("button_press_event",press_event,"on_fTabs")
tabs[0].set_events(gtk.gdk.BUTTON_PRESS_MASK)
tabs[0].add(gtk.Fixed())
tabs[0].set_visible_window(False)
mFrame=main.get_widget("viewport1")
tabs[0].show()
fTabs.append_page(tabs[0], tab_label=gtk.Label(u"Главная"))
mFrame.add(fTabs)
editor_buttons(main)
http://localhost:8888/admin/
http://www.aviacons.ru/admin/news/newspost/
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
htmltext = "<html><body>Market:<br>Вещи на продажу:<br><table width=300>" + htmltext + "</table></body></html>"
elif event.startswith("sell_"):
itemObjId = int(event.replace("sell_", ""))
obj = str(itemObjId)
Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId)
itemTemplate = Item.getItem()
if Item and itemTemplate.getDuration() == -1 and not Item.isEquipped() and not Item.isAugmented() and not Item.isConsumable() and Item.getItemType() != L2EtcItemType.OTHER and Item.getItemType() != L2EtcItemType.SCROLL and Item.getItemType() != L2EtcItemType.PET_COLLAR and Item.isTradeable() and Item.getItemId() != 403 or Item.getItemType() == L2EtcItemType.SHOT:# and Item.getEnchantLevel() == 0:
cnt = Item.getCount()
count = str(cnt)
grade = itemTemplate.getCrystalType()
igrade = str(itemTemplate.getCrystalType())
itype = str(Item.getItemType())
idtest = Item.getItemId()
con=L2DatabaseFactory.getInstance().getConnection()
listitems=con.prepareStatement("SELECT itemIcon FROM z_market_icons WHERE itemId=?")
listitems.setInt(1, idtest)
rs=listitems.executeQuery()
while (rs.next()) :
icon=rs.getString("itemIcon")
try :
if grade == 1:
pgrade = str("[D]")
elif grade == 2:
pgrade = str("[C]")
elif grade == 3:
pgrade = str("[b]")
elif grade == 4:
pgrade = str("[A]")
elif grade == 5:
pgrade = str("[S]")
else:
pgrade = str("")
if Item.getEnchantLevel() == 0:
enchant = str("")
else:
enchant = " +"+str(Item.getEnchantLevel())+""
st.set("sellitem",obj)
st.set("count",count)
st.set("grade",igrade)
st.set("type",itype)
htmltext = "<html><body>Market:<br>Вещь на продажу:<br>"
htmltext += "<img src=\"Icon."+str(icon)+"\" width=32 height=32>"
htmltext += "<font color=LEVEL>" + itemTemplate.getName() + ""+pgrade+" " + enchant + "</font><br><br>"
htmltext += "Количество: "+count+"<br>"
htmltext += "Установите цену: <br>"
htmltext += "<edit var=\"price\" width=250><br><button value=\"Ok\" action=\"bypass -h Quest q8033_MarketSell $price\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>"
htmltext += "<br>*установите цену за 1 предмет, конечная цена = кол-во*цену.</body></html>"
except :
try : insertion.close()
except : pass
try :
con.close()
except :
pass
#else :
#htmltext = "<html><body>Market:<br>Oops!</body></html>"
elif event >= 0 or event <=2144000000:
itemPrice = int(event)
itemObjId = st.getInt("sellitem")
itemCount = st.getInt("count")
itemGrade = st.getInt("grade")
itemPrice = int(itemPrice*itemCount)
Item = st.getPlayer().getInventory().getItemByObjectId(itemObjId)
itemTemplate = Item.getItem()
idtest = Item.getItemId()
itype = str(Item.getItemType())
itemType = str(Item.getItemType())
if Item and not Item.isEquipped() :
count = str(itemCount)
if Item.getEnchantLevel() == 0:
enchant = str("")
else:
enchant = " +"+str(Item.getEnchantLevel())+""
#weapons
if itype == "Sword":
ptype = str ("Weapon")
elif itype == "Blunt":
ptype = str ("Weapon")
elif itype == "Dagger":
ptype = str ("Weapon")
elif itype == "Bow":
ptype = str ("Weapon")
elif itype == "Etc":
ptype = str ("Weapon")
elif itype == "Pole":
ptype = str ("Weapon")
elif itype == "Fist":
ptype = str ("Weapon")
elif itype == "Dual Sword":
ptype = str ("Weapon")
elif itype == "Dual Fist":
ptype = str ("Weapon")
elif itype == "Big Sword":
ptype = str ("Weapon")
elif itype == "Big Blunt":
ptype = str ("Weapon")
#armor
elif itype == "Shield":
ptype = str ("Armor")
elif itype == "Light":
ptype = str ("Armor")
elif itype == "Heavy":
ptype = str ("Armor")
elif itype == "Magic":
ptype = str ("Armor")
elif itype == "None":
ptype = str ("Armor")
#recipes
elif itype == "Receipe":
ptype = str ("Recipe")
#resources
elif itype == "Material":
ptype = str ("Resource")
#spellbook
elif itype == "Spellbook":
ptype = str ("Spellbook")
#soulshot
elif itype == "Shot":
ptype = str ("Soulshot")
st.getPlayer().destroyItem("q8033_MarketSell",itemObjId, itemCount, st.getPlayer(), 0)
st.getPlayer().sendPacket(SystemMessage.sendString(""+count+ " " + itemTemplate.getName() + "" + enchant + " выстановлено на аукцион за "+str(itemPrice)+" adena"));
htmltext = "<html><body>Market:<br>Выстановлено на аукцион:<br><font color=LEVEL>"+count+" " + itemTemplate.getName() + "" + enchant + "</font> за "+str(itemPrice)+" adena"
#spellbook
elif itype == "Spellbook":
ptype = str ("Spellbook")
#soulshot
elif itype == "Shot":
ptype = str ("Soulshot")
+ if st.getQuestItemsCount(57) >= 2500:
+ st.takeItems(57,2500)
st.getPlayer().destroyItem("q8033_MarketSell",itemObjId, itemCount, st.getPlayer(), 0)
st.getPlayer().sendPacket(SystemMessage.sendString(""+count+ " " + itemTemplate.getName() + "" + enchant + " выстановлено на аукцион за "+str(itemPrice)+" adena"));
htmltext = "<html><body>Market:<br>Выстановлено на аукцион:<br><font color=LEVEL>"+count+" " + itemTemplate.getName() + "" + enchant + "</font> за "+str(itemPrice)+" adena"
#spellbook
elif itype == "Spellbook":
ptype = str ("Spellbook")
#soulshot
elif itype == "Shot":
ptype = str ("Soulshot")
+ st.takeItems(57,2500)
st.getPlayer().destroyItem("q8033_MarketSell",itemObjId, itemCount, st.getPlayer(), 0)
st.getPlayer().sendPacket(SystemMessage.sendString(""+count+ " " + itemTemplate.getName() + "" + enchant + " выстановлено на аукцион за "+str(itemPrice)+" adena"));
htmltext = "<html><body>Market:<br>Выстановлено на аукцион:<br><font color=LEVEL>"+count+" " + itemTemplate.getName() + "" + enchant + "</font> за "+str(itemPrice)+" adena"
######### Команда #########
<iq type='get'
from='123@i-taxi.com.ua'
to='disp@i-taxi.com.ua'
id='state'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='state' />
</iq>
######### Результат #########
<iq type='result'
from='disp@i-taxi.com.ua'
to='123@i-taxi.com.ua'
id='state'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='state' />
<feature var='В полете'/>
</query>
</iq>
<message
from='disp@i-taxi.com.ua'
to='123@i-taxi.com.ua'
xml:lang='ru'>
<body>Ушел в полет</body>
</message>