Kudzu Version of SonomaSunshine

2007-10-28 Thread SamFeltus

Funkiest SonomaSunshine page ever... A slim, trim 30ish MB page,
leaves time for fetching a beer or some coffee.  Takes about 10
minutes to watch.  Yet another example of using Django to generate
frilly, colorful Flash pages instead of more of that hypertext
stuff...

:)

http://samfeltus.com/kudzu/KudzuMan.html

###

http://samfeltus.com/site_index.html


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: i18n with custom tags

2007-10-28 Thread Malcolm Tredinnick

On Mon, 2007-10-29 at 04:35 +, Dan wrote:
> Hi
> 
> In the i18n docs it says you can pass in translations to template tags
> in the following format:
> 
> {% some_special_tag _("Page not found") value|yesno:_("yes,no") %}
> 
> * http://www.djangoproject.com/documentation/i18n/#in-template-code
> 
> Has anyone got this working? I wrote a basic custom tag just to pass
> the value back and it just displays _("Page not found")
> 
> any ideas?

Looks like a bug. Reading the code, there's no chance that it's going to
work either: we simply don't do i18n processing on template tag
arguments.

It looks like ticket #4713 contains the start of a fix for this. You
might like to try that (I don't have time right this minute to review
and apply that patch, but I thought your problem sounded familiar and
there it is). I'll probably avoid using yet another reg-exp in the final
patch, but it looks close at first glance.

Once you apply that patch, you'll have to call resolve_variable() -- or
use the Variable() class if you're using a recent subversion checkout --
on the argument in order to have it translated.

Regards,
Malcolm

-- 
The cost of feathers has risen; even down is up! 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



i18n with custom tags

2007-10-28 Thread Dan

Hi

In the i18n docs it says you can pass in translations to template tags
in the following format:

{% some_special_tag _("Page not found") value|yesno:_("yes,no") %}

* http://www.djangoproject.com/documentation/i18n/#in-template-code

Has anyone got this working? I wrote a basic custom tag just to pass
the value back and it just displays _("Page not found")

any ideas?

Thanks -Dan


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How do navigate through frames / framesets from a view?

2007-10-28 Thread @@
the target fram should be specified in the form's target attribute ( ie,
target='parent')

On 10/29/07, Andreas Pfrengle <[EMAIL PROTECTED]> wrote:
>
>
> Depending on the user's input in a form, I want to redirect to a view
> that's content should be rendered in a corresponding target frame
> (this can be either content in a "content"-frame or a new frameset in
> "_top" if the user chooses a new personal layout). Is it possible to
> do this via HttpResponseRedirect and choose a target frame? Or which
> other approach could I use to choose the target frame out of the view?
> Any suggestions are appreciated.
>
> Regards,
> Andreas
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: going back to previous page user was on, after form submission

2007-10-28 Thread @@
return HttpResponseRedirect('/login/?next=%s' % request.path)


On 10/29/07, crybaby <[EMAIL PROTECTED]> wrote:
>
>
> For example, many php forums will redirect you to the previous page
> you were in, when you login to the forum.  How do I do this in Python/
> Django?
>
> HTTP REFERER does not work all the time.  What is the best way to do
> this?
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Model and Template Problem

2007-10-28 Thread Malcolm Tredinnick

On Mon, 2007-10-29 at 11:53 +1100, Malcolm Tredinnick wrote:
> On Sun, 2007-10-28 at 14:45 -0700, niklas.voss wrote:
> > I have a Problem, i have one Model, which has some Data, and another
> > Model, which has some Data.
> > Let's call it Model1 and Model2! The Problem ist there is a Field in
> > Model1 which has an ID of a Model2-Object and Model1 has a function
> > that return the Model2-Object with that ID, too.
> > How can i call the information of the returning object from the
> > function in a template.
> > 
> > When I do it like this, it didnt work:
> > 
> > {{ model1object.givemodel2datafromid.data1 }}# data1 is just an
> > example-field
> 
> It's usually going to be easier for everybody if you explain your
> problem with a concrete example, rather than trying to use generic names
> for things. Otherwise mistakes will creep in and we (and you) won't be
> able to tell.
> 
> Can you show us an example of what Model1 and the givemodel2datafromid()
> method look like?
> 
> It sounds like you should be doing something simple like this:
> 
> class Model1(models.Model):
>model2 = models.ForeignKey(Model2)
>...
>def get_model2(self):
>   return self.model2

By the way, if this is like your example, you don't need this function
at all. You can just write

{{ model1object.model2 }}

to get the associated Model2 instance.

Not sure why I didn't write that initially. Still waking up on Monday
morning, apparently.

Regards,
Malcolm

-- 
The only substitute for good manners is fast reflexes. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Model and Template Problem

2007-10-28 Thread Malcolm Tredinnick

On Sun, 2007-10-28 at 14:45 -0700, niklas.voss wrote:
> I have a Problem, i have one Model, which has some Data, and another
> Model, which has some Data.
> Let's call it Model1 and Model2! The Problem ist there is a Field in
> Model1 which has an ID of a Model2-Object and Model1 has a function
> that return the Model2-Object with that ID, too.
> How can i call the information of the returning object from the
> function in a template.
> 
> When I do it like this, it didnt work:
> 
> {{ model1object.givemodel2datafromid.data1 }}# data1 is just an
> example-field

It's usually going to be easier for everybody if you explain your
problem with a concrete example, rather than trying to use generic names
for things. Otherwise mistakes will creep in and we (and you) won't be
able to tell.

Can you show us an example of what Model1 and the givemodel2datafromid()
method look like?

It sounds like you should be doing something simple like this:

class Model1(models.Model):
   model2 = models.ForeignKey(Model2)
   ...
   def get_model2(self):
  return self.model2

Then, in a template, 

{{ model1object.get_model2 }}

will be a Model2 object and you can use this further, such as

{{ model1object.get_model2.data1 }}

if "data1" is a field on Model2.

Does that look anything like the situation you are describing. If not,
what's a short example illustrating your problem?

Regards,
Malcolm

-- 
Despite the cost of living, have you noticed how popular it remains? 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: form submission from view1.py to view2.py

2007-10-28 Thread Malcolm Tredinnick

On Sun, 2007-10-28 at 08:48 -0700, crybaby wrote:
> For example, you are at this url:
> www.site.com/post/id/1
> 
> and view1.py display the view1.html for the above url.
> 
> In the view1.html, I have a form and need to submit some value to
> another view2.py
> 
> and validate, then send it back to view1.py so view1.html is displayed
> at the url: www.site.com/post/id/1.
> 
> Is this possible or I have to submit the form to view1.py rather than
> view2.py?
> 
> If this is possible, how do I do it?

Your form will have it's "action" attribute pointing to a URL that is
handled by view2.py. Then, at the end of view2, you send back an
HttpResponseRedirect that redirects the client to load the URL for view1
in their browser.

This is a fairly normal form processing path. See, for example,
http://www.djangoproject.com/documentation/newforms/#simple-view-example

Regards,
Malcolm

-- 
Depression is merely anger without enthusiasm. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



DualSessionMiddleware: Not working anymore on dev version of django

2007-10-28 Thread crybaby

I did a recent update on django and DualSessionMiddleware is not
working anymore.

http://code.djangoproject.com/wiki/CookBookDualSessionMiddleware

Seems like
from django.contrib.sessions.middleware import SessionWrapper is
replaced with
from django.contrib.sessions.middleware import SessionMiddleware.

I can't seem to get it to work with SessionMiddleware.  Anyone knows
how to fix it?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Model and Template Problem

2007-10-28 Thread niklas.voss

I have a Problem, i have one Model, which has some Data, and another
Model, which has some Data.
Let's call it Model1 and Model2! The Problem ist there is a Field in
Model1 which has an ID of a Model2-Object and Model1 has a function
that return the Model2-Object with that ID, too.
How can i call the information of the returning object from the
function in a template.

When I do it like this, it didnt work:

{{ model1object.givemodel2datafromid.data1 }}# data1 is just an
example-field



Can you solve this problem?

Thank you and sorry for my bad english,
Niklas Voß

P.S. If you need more Information or you haven't understand what I
said, just say it.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



MEET UR SCHOOL & COLLEGE FRIENDS. UR FRIENDS ARE WAITING FOR U..

2007-10-28 Thread [EMAIL PROTECTED]

IF you want to meet your old school & college mate's of your life
there is a chance, just enter school or college details in the below
site

http://www.batchmates.com/MGMhome.asp?refid=1385582=30264

PLEASE REGISTER IN THIS SITE.

IF U LIKE THEN FORWARD THIS MAIL TO U R FRIENDS...


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



going back to previous page user was on, after form submission

2007-10-28 Thread crybaby

For example, many php forums will redirect you to the previous page
you were in, when you login to the forum.  How do I do this in Python/
Django?

HTTP REFERER does not work all the time.  What is the best way to do
this?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



[announce] Python North-West meeting

2007-10-28 Thread Giacomo Lacava

Sorry for the spam, but as django users are (more or less) all python
users, I think this event might be considered relevant...? If not, I
won't do it again.

cheers, Giacomo
*
New meeting of the Python North-West community!

This month's talk is:
- Michael Sparks on "Greylisting with Kamaelia" - dramatic spam
reduction with a few lines of Python.

After the talk, you'll be able to showcase your cool python stuff, get
tips from others, have a chat with fellow-minded python geeks... and
relax with free refreshments and nibbles. Free wifi will also be
provided.

The meeting will take place at the Manchester Digital Development
Agency,
Lower Ground Floor, 117-119 Portland Street,
Manchester, England M1 6ED.
Thanks to the MDDA folks, who again let us use their facilities free
of charge.

Location map and further details are at
http://upcoming.yahoo.com/event/303512.  If can't find the venue on
the day, call 0779 6690731 and we'll rescue you.

If you want to give a second (brief) talk at this meeting (or the main
talk at the next one, why not...), please post the idea on the mailing
list (http://groups.google.com/group/python-north-west) or mail
[EMAIL PROTECTED]

Subscribe to the Python North-West Google Calendar (linked at
http://groups.google.com/group/python-north-west in various formats)
to get notified of all future meetings and events.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How do navigate through frames / framesets from a view?

2007-10-28 Thread Andreas Pfrengle

Depending on the user's input in a form, I want to redirect to a view
that's content should be rendered in a corresponding target frame
(this can be either content in a "content"-frame or a new frameset in
"_top" if the user chooses a new personal layout). Is it possible to
do this via HttpResponseRedirect and choose a target frame? Or which
other approach could I use to choose the target frame out of the view?
Any suggestions are appreciated.

Regards,
Andreas


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



object and related object on one form (newforms)

2007-10-28 Thread Rob Slotboom

Can someone please explain to me how to create a form which provides
not only the fields for the object but also the fiels for a related
object (foreign key) and the best method to validate and save the
data?

Thanks in advance,

Rob


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is it possible to debug a view using breakpoints in Eclipse?

2007-10-28 Thread Karen Tracey
Hmm, that's odd.  I don't know what to say except the ever-infuriating
worksforme.  When it doesn't work it is almost invariably because I have
changed code without restarting the server, so what I'm looking at and
setting breakpoints on in the editor doesn't match what's running under the
debugger.  I also confused it mightily one time by moving whole trees of
code around without deleting the .pyc files.  Other than that, it behaves as
expected.  Maybe double-triple check the --noreload is being recognized
properly by tracing through the startup processing of it?  Sorry I don't
have any better ideas,
Karen

On 10/28/07, Divan Roulant <[EMAIL PROTECTED]> wrote:
>
>
> Thanks Karen,
>
> yes, I use --noreload to run manage.py inside Eclipse. I can trace as
> long as the code that is executed is from manage.py. If I use the
> browser to execute views, then no breakpoints are stopped at...
>
> On 27 oct, 18:57, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > I assume you are using the development server to test -- have you
> included
> > --noreload among the arguments to runserver when you run under
> > Eclipse/PyDev?  That's what you need in order for breakpoints to work.
> >
> > Karen
> >
> > On 10/27/07, Divan Roulant <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Hello,
> >
> > > I would like to debug a view and even though I set breakpoints in it,
> > > the debugger doesn't stop on them when the execution is required by
> > > the Web browser. I'm using Eclipse with PyDev and everything seems
> > > configured appropriately.
> >
> > > Since I'm pretty new to Web dev, maybe there's something I don't get
> > > that makes it impossible. Is it the case? If not, how may I debug a
> > > view?
> >
> > > Thanks a lot!
> >
> > > Divan
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: elance'in django programmers

2007-10-28 Thread Todd O'Bryan

The other complication is that, in the United States, contractors have
to include in their hourly rate the employer's portion of payroll
taxes as well as enough money to pay for health insurance and other
benefits that might be provided by virtue of citizenship in other
countries, but which the contractor has to pay for him/herself. That
tends to inflate the hourly rate of contractors compared with
employees.

Todd

On 10/25/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Well the more skills you have as a programmer... the more work is
> available to you... but also the more skills you have...the more you
> expect to be paid.
>
> Someone that knows only PHP ... or only knows Flash Actionscript,
> etc shouldn't expect to get paid as much as a developer who is
> knowledgeable in many languages.  Similarly, a newbie programmer with
> only a few months experience, or no 'professional' experience,
> shouldn't expect to be paid the same as a developer with many years of
> software/web application development experience under their belt.
>
> On Oct 25, 10:42 pm, Roboto <[EMAIL PROTECTED]> wrote:
> > That's true, I didn't think about this at first - it's difficult to
> > make it as a programmer with market dilution.
> >
> > On Oct 25, 10:38 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote:
> >
> > > Speaking as someone who's tried their hand at both sides of the coin,
> > > I definitely agree with you, Ross. I'm currently employed, but when I
> > > was trying to make it as a contractor (because a job fell through), I
> > > couldn't land a single job because of the market dillution. Working in
> > > PHP as I was, I found that I was competing against high school and
> > > college students, whose bills are paid by their parents, and can
> > > afford to spend weeks on end getting paid next to nothing. And yes,
> > > the quality of their work showed.
> >
> > > The trouble with most good developers is that they're not willing to
> > > work for cheap change. And it often has little to do with getting paid
> > > appropriately for their skill level. For me, and many others, the high
> > > price is necessary because we have families and mortgages to support.
> > > Contracting for a low price is only good for a certain type of people,
> > > and that pool doesn't contain very many quality developers.
> >
> > > Just keep in mind that contractors don't have an endless pool of jobs
> > > to choose from, where they can just pick whatever price they feel
> > > like. They have to make sure that each job can sustain them until they
> > > secure another job. It's not a fun way to live unless you're already
> > > very well established.
> >
> > > -Gul
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



form submission from view1.py to view2.py

2007-10-28 Thread crybaby

For example, you are at this url:
www.site.com/post/id/1

and view1.py display the view1.html for the above url.

In the view1.html, I have a form and need to submit some value to
another view2.py

and validate, then send it back to view1.py so view1.html is displayed
at the url: www.site.com/post/id/1.

Is this possible or I have to submit the form to view1.py rather than
view2.py?

If this is possible, how do I do it?

joe


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How-to implement state pattern persisting it?

2007-10-28 Thread sserrano

Hi Malcolm
  Many thanks for your verbose answer, i have to think the way i will
represent this. By the moment i don't have instance variables over the
state objects, so i was thinking that i could store the state "name"
and make a getter using something like a Factory. How much awful seem
to you this?

Many Many, Thanks
Sebastian

On 28 oct, 06:23, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> On Sun, 2007-10-28 at 20:18 +1100, Malcolm Tredinnick wrote:
> > On Sun, 2007-10-28 at 08:43 +, [EMAIL PROTECTED] wrote:
> > > Hi Malcolm
> > >   In my design i have a class called publication, that behaves
> > > different depending on the "state", so i have an state hierarchy that
> > > implement via polymorphism the different ways the publication behaves.
> > >   I have been reading the djangobook and searching the net, looking a
> > > way to implement this without lucky. Maybe i'm asking something a lot
> > > trivial, sorry me if that is the case.
>
> > You can simulate inheritance by using foreign keys or one to one keys.
> > For example:
>
> > class Parent(models.Model):
> > some_data = ...
> > 
>
> > class Child(models.Model):
> > parent = models.ForeignKey(parent, unique=True)
> > ...
>
> I forgot to mention the alternative: storing complex object-oriented
> hierarchies in SQL databases is officially a Hard Problem. It's just not
> a natural fit for all cases. So turn your problem around a bit and don't
> get stuck on one particular modelling method. Instead of storing the
> classes directly like this, try to think of a way to flatten your
> collection of classes. For example, if all of you "state nodes" can be
> stored in a single model somehow, then you only need to store, in
> addition to these models, the state transitions.
>
> Remember, state machines existed long before object-oriented
> programming. There are other ways to represent the same information
> without needing polymorphism and this might lead you to a more natural
> representation.
>
> Regards,
> Malcolm
>
> --
> The cost of feathers has risen; even down is 
> up!http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can't post attachment file in django test

2007-10-28 Thread Karen Tracey
My question on the file object was a shot in the dark based on the only
thing that looked odd to me, given that the traceback information was
useless.  So, if that seems to be correct per the docs, then I think you'll
need to get the traceback from the actual error in order to make progress.
>From my original note:

To see the traceback associated with the real error try setting DEBUG=True
in your test settings file (I assume that works when running under the test
framework?  If not you'll need a 500.html that Django can find and the
proper other settings to have the real root cause traceback emailed to you).


Karen

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is it possible to debug a view using breakpoints in Eclipse?

2007-10-28 Thread Divan Roulant

Thanks Karen,

yes, I use --noreload to run manage.py inside Eclipse. I can trace as
long as the code that is executed is from manage.py. If I use the
browser to execute views, then no breakpoints are stopped at...

On 27 oct, 18:57, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> I assume you are using the development server to test -- have you included
> --noreload among the arguments to runserver when you run under
> Eclipse/PyDev?  That's what you need in order for breakpoints to work.
>
> Karen
>
> On 10/27/07, Divan Roulant <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello,
>
> > I would like to debug a view and even though I set breakpoints in it,
> > the debugger doesn't stop on them when the execution is required by
> > the Web browser. I'm using Eclipse with PyDev and everything seems
> > configured appropriately.
>
> > Since I'm pretty new to Web dev, maybe there's something I don't get
> > that makes it impossible. Is it the case? If not, how may I debug a
> > view?
>
> > Thanks a lot!
>
> > Divan


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How-to implement state pattern persisting it?

2007-10-28 Thread [EMAIL PROTECTED]

Hi Malcolm
  In my design i have a class called publication, that behaves
different depending on the "state", so i have an state hierarchy that
implement via polymorphism the different ways the publication behaves.
  I have been reading the djangobook and searching the net, looking a
way to implement this without lucky. Maybe i'm asking something a lot
trivial, sorry me if that is the case.

Thanks to you, Sebastián
PD: English is not my natural language, sorry my spell errors.

On 28 oct, 05:13, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> On Sun, 2007-10-28 at 07:09 +, [EMAIL PROTECTED] wrote:
> > Hi
> >   If i'm not wrong the model inheritance is not complete. How you
> > turnaround this problem, when you had to implement the state pattern
> > or the strategy?
> >   Any idea is welcome!!
>
> Could you perhaps ask your question using less buzzwords, since "the
> state pattern" would mean quite a few things? What are you really trying
> to do here? A concrete example will help people provide with an
> appropriate answer.
>
> Thanks,
> Malcolm
>
> --
> Despite the cost of living, have you noticed how popular it 
> remains?http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How-to implement state pattern persisting it?

2007-10-28 Thread Malcolm Tredinnick

On Sun, 2007-10-28 at 20:18 +1100, Malcolm Tredinnick wrote:
> On Sun, 2007-10-28 at 08:43 +, [EMAIL PROTECTED] wrote:
> > Hi Malcolm
> >   In my design i have a class called publication, that behaves
> > different depending on the "state", so i have an state hierarchy that
> > implement via polymorphism the different ways the publication behaves.
> >   I have been reading the djangobook and searching the net, looking a
> > way to implement this without lucky. Maybe i'm asking something a lot
> > trivial, sorry me if that is the case.
> 
> You can simulate inheritance by using foreign keys or one to one keys.
> For example:
> 
> class Parent(models.Model):
> some_data = ...
> 
> 
> class Child(models.Model):
> parent = models.ForeignKey(parent, unique=True)
> ...

I forgot to mention the alternative: storing complex object-oriented
hierarchies in SQL databases is officially a Hard Problem. It's just not
a natural fit for all cases. So turn your problem around a bit and don't
get stuck on one particular modelling method. Instead of storing the
classes directly like this, try to think of a way to flatten your
collection of classes. For example, if all of you "state nodes" can be
stored in a single model somehow, then you only need to store, in
addition to these models, the state transitions.

Remember, state machines existed long before object-oriented
programming. There are other ways to represent the same information
without needing polymorphism and this might lead you to a more natural
representation.

Regards,
Malcolm

-- 
The cost of feathers has risen; even down is up! 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How-to implement state pattern persisting it?

2007-10-28 Thread Malcolm Tredinnick

On Sun, 2007-10-28 at 08:43 +, [EMAIL PROTECTED] wrote:
> Hi Malcolm
>   In my design i have a class called publication, that behaves
> different depending on the "state", so i have an state hierarchy that
> implement via polymorphism the different ways the publication behaves.
>   I have been reading the djangobook and searching the net, looking a
> way to implement this without lucky. Maybe i'm asking something a lot
> trivial, sorry me if that is the case.

You can simulate inheritance by using foreign keys or one to one keys.
For example:

class Parent(models.Model):
some_data = ...


class Child(models.Model):
parent = models.ForeignKey(parent, unique=True)
...

It's not completely transparent, because you have to manually walk the
link from a child back to the parent (refer to
my_child.parent.some_data, instead of child.some_data as you get in true
inheritance). It's also sometimes a bit fiddly to walk down the
hierarchy: if you have a Parent, finding the associated Child can be
fiddly. When I've done this in the past, I tend to denormalise slightly
and through in a "child_type" field on the Parent model that tells me
which type of child class to query. A little verbose, but you usually
only have to write the "descend the hierarchy" code once and call it
whenever you need it.

Even when we implement model inheritance for the ORM layer, you won't
get truly transparent duck-typing in any case: that is, given a Parent,
you won't automatically know the type of its child because that would
involve O(n) table joins (where n is the number of ancestor types of the
parent -- children, grandchildren, great-grandchildren, etc), so that's
an inefficient search approach (and we're not about to add extra columns
just to store the descendant classes, since that breaks subclassing
third-party models).

So since it sounds like you are going to be taking the Parent instances
and trying to access the class associated with it, it's probably worth
implementing something like a child_type attribute that tells you where
to look. Then when model inheritance is implemented, it won't be too
much of a change to port your code across.

Regards,
Malcolm

> 
> Thanks to you, Sebasti�n
> PD: English is not my natural language, sorry my spell errors.
> 
> On 28 oct, 05:13, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> > On Sun, 2007-10-28 at 07:09 +, [EMAIL PROTECTED] wrote:
> > > Hi
> > >   If i'm not wrong the model inheritance is not complete. How you
> > > turnaround this problem, when you had to implement the state pattern
> > > or the strategy?
> > >   Any idea is welcome!!
> >
> > Could you perhaps ask your question using less buzzwords, since "the
> > state pattern" would mean quite a few things? What are you really trying
> > to do here? A concrete example will help people provide with an
> > appropriate answer.
> >
> > Thanks,
> > Malcolm
> >
> > --
> > Despite the cost of living, have you noticed how popular it 
> > remains?http://www.pointy-stick.com/blog/
> 
> 
> > 
> 
-- 
Borrow from a pessimist - they don't expect it back. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How-to implement state pattern persisting it?

2007-10-28 Thread Malcolm Tredinnick

On Sun, 2007-10-28 at 07:09 +, [EMAIL PROTECTED] wrote:
> Hi
>   If i'm not wrong the model inheritance is not complete. How you
> turnaround this problem, when you had to implement the state pattern
> or the strategy?
>   Any idea is welcome!!

Could you perhaps ask your question using less buzzwords, since "the
state pattern" would mean quite a few things? What are you really trying
to do here? A concrete example will help people provide with an
appropriate answer.

Thanks,
Malcolm

-- 
Despite the cost of living, have you noticed how popular it remains? 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: nginx + django dev server => WSGIRequestHandler instance has no attribute 'path'

2007-10-28 Thread Malcolm Tredinnick

On Sat, 2007-10-27 at 21:54 -0700, globophobe wrote:
> I checked out a recent copy of django from svn recently, and
> "path_info" returned to rear its ugly head. The patch as per
> http://code.djangoproject.com/ticket/3414 (mostly) resolves the
> issue.

One of my problems with the patch on #3414 is that it doesn't really
give any authority as to *why* that solution is the right answer, as
opposed to "it works in my case when I do this". Why is REQUEST_URL a
valid fallback? Is this a special thing that is set by a particular web
server? Without reference to documentation (or at least a particular
product, if we are putting in a product-specific workaround), a patch
isn't likely to go in because it just be mysterious black magic for
future maintainers. Every time I look at that ticket, I remember that
it's going to be work to try and work out what's really going on and
why. So if you want the patch to go in, you could do the leg work and
work out why those changes are the right ones (attach the results to the
ticket).

> 
> There doesn't seem to be a problem with FastCGI on my iBook nor on my
> FreeBSD production machine; however, for some reason that I'm not
> bright enough to understand, there is a problem with the simple
> included server in conjunction with a server such as nginx, and
> possibly others. This is a problem with both the bleeding edge svn
> checkout as well as the most recent stable verstion of django over
> plain old HTTP:

It's not clear from your email: are you reporting something new, or just
saying the same problem happens to you? In the latter case, well,
there's a ticket already open for it.

Malcolm

-- 
I intend to live forever - so far so good. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can't post attachment file in django test

2007-10-28 Thread Igor Kovalenko

> Is the value assigned to 'galleryfilename' really supposed to be an open
> file object?  Just based on the name it sounds more like it should be a
> string containing the file name.

Ok. Let's be clear. I have a form with 3 inputs:
input type="text" name="name"
textarea name="annotation"
input type='file' accept='image/jpeg' name='galleryfilename'

And in my test I need to simulate user input of with fields. So as was
written in the manual http://www.djangoproject.com/documentation/testing/,
quote:
...
Submitting files is a special case. To POST a file, you need only
provide the file field name as a key, and a file handle to the file
you wish to upload as a value. For example:
>>> c = Client()
>>> f = open('wishlist.doc')
>>> c.post('/customers/wishes/', {'name': 'fred', 'attachment': f})
>>> f.close()
(The name attachment here is not relevant; use whatever name your file-
processing code expects.)
Note that you should manually close the file after it has been
provided to post().
...

My view processes the /fotogallery/addgallery/ url with the following
way:

name = request.POST['name']
annot = request.POST['annotation']
fname = request.FILES['galleryfilename']['filename']
path = MEDIA_ROOT + "/galleryfoto/" + fname
im = Image.open(StringIO(request.FILES['galleryfilename']['content']))
im.save(path,'JPEG')

Did I miss something?
I'm using django 0.96 official release (not development version)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How-to implement state pattern persisting it?

2007-10-28 Thread [EMAIL PROTECTED]

Hi
  If i'm not wrong the model inheritance is not complete. How you
turnaround this problem, when you had to implement the state pattern
or the strategy?
  Any idea is welcome!!

Thanks in advance!!
Sebastián


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Search returns every object

2007-10-28 Thread Joel Hooks

On Oct 27, 10:57 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On 10/27/07, Joel Hooks <[EMAIL PROTECTED]> wrote:
>
> But firm is a ForeignKey.  I think firm, by itself, without any __fieldname
> appended, is causing the whole search attempt to fail.  The e=1 in where you
> get redirected to is a clue something went awry.  I'm guessing when the
> attempt to search the ForeignKey field causes an error, the admin gives up
> and just returns the whole unfiltered list, plus puts e=1 in place of your
> query string to indicate something isn't working.  So, what happens if you
> either remove firm from the search_fields or specify the field in firm you
> want to search on?
>
> Karen

Spot on! Thanks.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 0.96 login issue with cookies

2007-10-28 Thread Mike

No, the cache was off all the time.

On Oct 19, 8:44 am, web-junkie <[EMAIL PROTECTED]> wrote:
> Did you activate the cache in Django? I once discovered an issue with
> that..


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---