On Monday, January 17, 2011 2:24:39 PM UTC, Santiago Caracol wrote: > > Hello, > > I have got a model called ContentClassifier which uses regular > expressions to classify the content of messages. It has a method > compile() that compiles an instance's regular expressions into > self.posrx. When the classify method calls compile, i.e. when each > ContentClassifier compiles its regular expressions every time it's > classify-method is called, then the ContentClassifiers work as > expected. (I.e. if, in the code given below snippet 2 instead of > snippet 1 is used). If, on the other hand, I want each instance to > compile its regular expressions when it is saved (i.e. if I use > snippet 1 instead of snippet 2), Django says > > AttributeError: ... ContentClassifier' object has no attribute 'posrx' > > Why? > > When does Django raise that - on save, or when you later try and use the object? Why didn't you post the full traceback?
What actually is `self.posrx`? Is it a model field? If so, how are you storing the compiled regexes? -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

