Re: httplib exception in Django model
Hello, On Wednesday, September 19, 2012 7:45:00 PM UTC+2, Alexis Roda wrote: > > Al 19/09/12 10:42, En/na airween ha escrit: > > >File "/usr/lib/python2.6/socket.py", line 547, in create_connection > > for res in getaddrinfo(host, port, 0, SOCK_STREAM): > > error: Int or String expected > > >>> > > > > > > What should I do, what is the problem? > > According to the last line it seems that 'host' or 'port' have the wrong > type. Since 'host' must be an string or None the problem seems to be > related with 'port'. > > Printing httphost and httpport's type and value before creating the > connection may give you some clue. > > > well, you're right :), I printed out the values of those variables, but not types. But now I see, the type of httpport is 'long' instead of 'int' (it cames from a Django model). Typecast resolves this problem, thanks :) a. > HTH > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/z0DoEANiGxoJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
httplib exception in Django model
Hello, here is the sample code: #!/usr/bin/python > # -*- charset: utf-8 -*- > > import sys > import httplib > import base64 > > > httphost, httpport = "www.foo.com", 80 > httpuri = "/addrs.php" > > conn = httplib.HTTPConnection(httphost, httpport) > > conn.request("GET", str(httpuri)) > > > r1 = conn.getresponse() > print r1.read() > conn.close() > > If I put this code to a model, and that function has called, I get this exception: (this is from manage.py shell, but through HTTP gives same result) Traceback (most recent call last): File "", line 1, in File "/home/global/htdocs/path/to/docsync/models.py", line 253, in sync conn.request("GET", str(h.httpuri)) File "/usr/lib/python2.6/httplib.py", line 914, in request self._send_request(method, url, body, headers) File "/usr/lib/python2.6/httplib.py", line 951, in _send_request self.endheaders() File "/usr/lib/python2.6/httplib.py", line 908, in endheaders self._send_output() File "/usr/lib/python2.6/httplib.py", line 780, in _send_output self.send(msg) File "/usr/lib/python2.6/httplib.py", line 739, in send self.connect() File "/usr/lib/python2.6/httplib.py", line 720, in connect self.timeout) File "/usr/lib/python2.6/socket.py", line 547, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): error: Int or String expected >>> What should I do, what is the problem? Thanks: a. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/-q4DQgl2AMwJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
"Dynamyc" modells
Hello, I don't know how can I tell you my question :) There are many lists - lists contains items (in this case those items are promotion codes for marketing agencies, but it doesn't matter). I need (I want) to store every lists in different table. I can make a List model, which describes name of list, table which contains items, and so on. But then, I want to use every lists as List model - is it possible? I mean, I can use get(), filter() and other methods of model. If yes, what should I read to know this? Thanks: a. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Different classes uses different databases
Hello there, I have to create two (or more) classes, and rows of classes are stored in different databases. I've read about multi-db: https://docs.djangoproject.com/en/dev/topics/db/multi-db/ - that's clear for me. (Or may be I'm confused...) Is it the only way to handle the databases and classes relations? I mean, there would be a meta attribute (example), which describe that class which database have to use... Any idea? Thanks: a. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.