I am looking to build a Single-signon system for a couple web apps that used form based authentication. 
They way that I envision it is that my sso system would handle authentication against active directory pass the verification through to the desired web app when ever the used clicked a link through my sso portal.
What might be the b...
            
           
          
            
            Say I have the following in my models.py:
class Company(models.Model):
   name = ...
class Rate(models.Model):
   company = models.ForeignKey(Company)
   name = ...
class Client(models.Model):
   name = ...
   company = models.ForeignKey(Company)
   base_rate = models.ForeignKey(Rate)
I.e. there are multiple Companies, each having a...
            
           
          
            
            What exactly are the Python scoping rules?
If I have come code:
code1
class Foo:
   code2
   def spam.....
      code3
      for code4..:
       code5
       x()
Where is x found?  Some possible choices include the list above:
In the enclosing source file
In the class namespace
In the function definition
In the for loop index varia...
            
           
          
            
            How can I poll the keyboard from a console python app?  Specifically, I would like to do something akin to this in the midst of a lot of other I/O activities (socket selects, serial port access, etc.):
   while 1:
      # doing amazing pythonic embedded stuff
      # ...
      # periodically do a non-blocking check to see if
      # we...
            
           
          
            
            I have the following regex expression to match html links:
<a\s*href=['|"](http:\/\/(.*?)\S['|"]>
it kind of works. Except not really. Because it grabs everything after the < a href...
and just keeps going. I want to exclude the quote characters from that last \S match. Is there any way of doing that?
EDIT: This would make it grab on...
            
           
          
            
            I'm having an error where I am not sure what caused it.
Here is the error:
Exception Type:     OperationalError
Exception Value:    
(1054, "Unknown column 'user_id' in 'field list'")
Does anyone know why I am getting this error? I can't figure it out. Everything seems to be fine. 
My view code is below:
if "login" in request.sessi...
            
           
          
            
            Hi Guys,
I am making a little GUI frontend for a app at the moment using wxPython.
I am using wx.StaticText() to create a place to hold some text, code below:
content = wx.StaticText(panel, -1, "Text Here", style=wx.ALIGN_CENTRE)
I have a button when clicked retrieves data from MySQL, I am wanting to change the value of the StaticTe...
            
           
          
            
            Why won't this work?  I'm trying to make an instance of a class delete itself.
>>> class A():
    def kill(self):
     del self
>>> a = A()
>>> a.kill()
>>> a
<__main__.A instance at 0x01F23170>
...
            
           
          
            
            I'm writing a simple program that's going to parse a logfile of a packet dump from wireshark into a more readable form. I'm doing this with python.
Currently I'm stuck on this part:
for i in range(len(linelist)):
if '### SERVER' in linelist[i]:
 #do server parsing stuff
 packet = linelist[i:find("\n\n", i, len(linelist))]
linelist i...
            
           
          
            
            I need to sanitize HTML submitted by the user by closing any open tags with correct nesting order. I have been looking for an algorithm or Python code to do this but haven't found anything except some half-baked implementations in PHP, etc.
For example, something like
<p>
  <ul>
    <li>Foo
becomes
<p>
  <ul>
    <li>Foo</li>
  </ul...
            
           
          
            
            I want to automate several tasks (eg. simulate eclipse style ctrl-shift-r open dialog for other editors). The general pattern is: the user will press some key combination, my program will detect it and potentially pop up a dialog to get user input, and then run a corresponding command, typically by running an executable.
My target envir...
            
           
          
            
            Python provides the "*" operator for unpacking a list of tuples and giving them to a function as arguments, like so:
args = [3, 6]
range(*args)            # call with arguments unpacked from a list
This is equivalent to:
range(3, 6)
Does anyone know if there is a way to achieve this in PHP? Some googling for variations of "PHP Unpa...
            
           
          
            
            I need to set my process to run under 'nobody', I've found os.setuid(), but how do I find uid if I have login?
I've found out that uids are in /etc/passwd, but maybe there is a more pythonic way than scanning /etc/passwd. Anybody?
...
            
           
          
            
            Hi,
I am searching for an open-source implementation of an UPnP client in Python, and more specifically of its Internet Gateway Device (IGD) part.
For now, I have only been able to find UPnP Media Server implementations, in projects such as PyMediaServer, PyMedS, BRisa or Coherence.
I am sure I could use those code bases as a start, b...
            
           
          
            
            I'm generating C++ code, and it seems like it's going to get very messy, even my simple generating classes already have tons of special cases.  Here is the code as it stands now: http://github.com/alex/alex-s-language/tree/local%2Fcpp-generation/alexs_lang/cpp .
...
            
           
          
            
            I'm using django and when users go to www.website.com/ I want to point them to the index view.
Right now I'm doing this:
(r'^$', 'ideas.idea.views.index'),
However, it's not working. I'm assuming my regular expression is wrong. Can anyone help me out? I've looked at python regular expressions but they didn't help me. 
...
            
           
          
            
            I have a few model classes with basic one-to-many relationships.  For example, a book has many recipes, and each recipe has many ingredients:
class Book(models.Model):
    name = models.CharField(max_length=64)
class Recipe(models.Model):
    book = models.ForeignKey(Book)
    name = models.CharField(max_length=64)
class Ingredient(mo...
            
           
          
            
            I've explored python for several years, but now I'm slowly learning how to work with c.  Using the python documentation, I learned how to extend my python programs with some c, since this seemed like the logical way to start playing with it.  My question now is how to distribute a program like this.
I suppose the heart of my question is...
            
           
          
            
            How do i turnoff WRITEFUNCTION and WRITEDATA ?
using pycurl i have a class call curlUtil. In it i have pageAsString(self, url) which returns a string. To do this i setopt WRITEFUNCTION. Now in downloadFile(self, url, fn, overwrite=0) i do an open and self.c.setopt(pycurl.WRITEFUNCTION, 0) which cause problems. int is not a valid argueme...
            
           
          
            
            I have a port scanning application that uses work queues and threads, it uses simple TCP connections and spends a lot of time waiting for packets to come back (up to half a second). Thus the threads don't need to fully execute (i.e. first half sends a packet, context switch, does stuff, comes back to thread which has network data waiting...