Re: full-text indexing

2007-08-08 Thread Gábor Farkas

Jarek Zgoda wrote:
> I don't know what do you mean by "transactions" in case of full-text
> search engine as it doesn't do any multi-step updates (only single-
> step deletes or inserts in case of PyLucene).
> 
> Anybody who wants to use PyLucene, be aware that you cann't embed (iow
> "use", "import") PyLucene in your Django application code if your web
> server is either forking or threadinig one. You have to build a
> service that is separated from any threading or forking. Does it still
> seems reasonable to anybody? Well, if yes, welcome to pylucene-dev
> mailing list. ;)

another way to use Lucene in django would be solr 
(http://lucene.apache.org/solr/), but i have never tried it.

gabor

--~--~-~--~~~---~--~~
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: mod_python/django problems

2007-08-06 Thread Gábor Farkas

Jacob Kaplan-Moss wrote:
> On 8/3/07, Aljosa Mohorovic <[EMAIL PROTECTED]> wrote:
>> on few blogs/web sites it is stated that > 30 django sites on one
>> server running apache/mod_python have some issues, like untraceable
>> errors and wrong site displaying for some domain.
>> any comments on this?
> 
> When something like this happens, it's usually because of a missing
> PythonInterpreter and/or DJANGO_SETTINGS_MODULE directive.
> 
> We've had far more than 30 sites on a single Apache, no problems. I
> use the past-tense since we've started running multiple instances of
> Apache (instead of one monolithic one with many vhosts) so that we
> have greater granular control over each individual site.
> 

did you go as far as having 1 apache / 1 app? or more like grouping 5-10 
sites into one apache?

did it change the memory-usage in any way?

(i mean, did 1 apache with 30 sites use the same amount of memory than 
30 apache with 1site/apache?)


thanks,
gabor

--~--~-~--~~~---~--~~
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: mod_python/django problems

2007-08-06 Thread Gábor Farkas

Matt Davies wrote:
> We've got over 70 sites running on lighttpd, no problems at all.
> 

with fastcgi/flup?

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



database replication/failover...

2007-08-06 Thread Gábor Farkas

hi,

how do/did you approach/solve the "what happens if the database (server) 
dies?" problem?

what kind of replication/failover solutions do you use?

(i'm primarily interested in postgres..)

i'm not talking about database-replication solutions for performance 
reasons (scaling etc..).

i already collected some approaches that might be worth investigating 
(pgpool,slony,heartbeat,drbd for example), and would like to know if 
there are also some other solutions/approaches..

or, if someone has some experience that he's willing to share, i'd be 
glad to listen to "what worked" and "what did not work".

thanks,
gabor

--~--~-~--~~~---~--~~
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: mod_python, multiple django-sites, memory usage

2007-07-24 Thread Gábor Farkas

Graham Dumpleton wrote:
> On Jul 24, 6:28 pm, Gábor Farkas <[EMAIL PROTECTED]> wrote:
>> hi,
>>
>> how does it work exactly, when i have multiple django sites running in
>> one apache server using mod_python?
>>
>> for example, imagine that i have 10 django sites running in one apache
>> server.
>>
>> does that mean, that in every apache process, i have 10 python
>> interpreters loaded?
> 
> Yes.
> 
>> or in other words, if i have 10 django sites in one apache, does it use
>> 10times more memory than when running only one django site?
> 
> More or less, yes.
> 
> If you tested that your code on top of Django and any third party
> modules you use is multithread safe then you can limit the overal
> memory used across all processes by using the 'worker' MPM for Apache
> rather than the 'prefork' MPM. This helps because with 'worker' you
> run with a lot less Apache child processes than with 'prefork'. The
> number of Apache child processes can still spike up with 'worker' MPM
> when there is the demand, but as demand drops off, Apache will kill
> off excess processes. Even so, that each instance occupies memory in
> each process still means a lot of memory overall.
> 
> If you need more control than that then you would need to explore
> other options such as daemon mode of mod_wsgi or mod_fastcgi, which
> both provide the ability to run each Django instance in a defined
> number of distinct daemon processes. In the extreme case, you could
> run Django on top of a Python WSGI server and run it in just a single
> process behind Apache by proxying requests to it.
> 
> Memory use of running multiple Django instances under Apache using
> mod_python is only one of the problems that can arise in this
> instance. Other problems are the ability for the Django instances to
> interfere with each other due to C extension modules which haven't
> been written properly to be used from multiple sub interpreters at the
> same time, or even attempts to use different versions of a C extension
> module from the different Django instances. Using mod_wsgi or
> mod_fastcgi may therefore be a better solution given they allow
> separation of the Django instances.
> 
> So, the question is, what are you trying to achieve or want? Was there
> a specific reason for the question? Knowing what you are really trying
> to do, might be able to suggest others things you can read to learn
> how Apache manages processes and how Python sub interpreters are used
> in this scenario.

thanks for the information.

for various reasons, some of our django applications are running using 
apache+fastcgi, and some using apache+mod_python. we were preferring 
mod_python (because it's the "recommended" setup for django),
and only used the fastcgi-solution where we could not use mod_python 
(again, various stupid reasons :)

but now we will probably have to add more django applications to the 
system, so i was thinking if it should be done using mod_python or 
fastcgi (i am sorry but i did not consider mod_wsgi, because i had the 
feeling that it's still "too new". btw. would you consider it 
production-ready? (i understand that it's a stupid question :))

so from what i've read here, it seems fastcgi/mod_wsgi-daemon-mode would 
be the safest route (i've read the discussion about psycopg2+decimal on 
django-devel).

btw. what do you think about having multiple apache-servers with 
mod_python, each hosting only one django-application.

would that be an overkill?

p.s: the django-applications i am talking about are intranet-apps, so we 
do not think there will be much load on them...

thanks,
gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



mod_python, multiple django-sites, memory usage

2007-07-24 Thread Gábor Farkas

hi,

how does it work exactly, when i have multiple django sites running in 
one apache server using mod_python?

for example, imagine that i have 10 django sites running in one apache 
server.

does that mean, that in every apache process, i have 10 python 
interpreters loaded?

or in other words, if i have 10 django sites in one apache, does it use 
10times more memory than when running only one django site?

thanks,
gabor

--~--~-~--~~~---~--~~
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: nasa site on django

2007-07-04 Thread Gábor Farkas

Jeremy Dunck wrote:
>>   Frankly I think a generic python application server similar to tomcat
>> would do a world of good for python apps in general. Something similar to
>> cherrypy... but this is beyond the responsibilities of the django community
>> which have plenty great work left.
> 
> Similar to CherryPy but not it?  How come?  In any case, if you're
> thinking this way, consider Aspen/Stephane:
> http://www.zetadev.com/software/aspen/
> 
> It appears to be thread-per-request.

so all the usual issues (and non-issues) with the python GIL apply...


btw. i never understood what's so nice about those pure-python (or 
pure-ruby (mongrel etc.)) web-servers..

for example regarding performance/memory-consumption/whatever,

why should apache+mod_python be worse than a pure-python-web-server?

let's say with the single-process multi-threaded apache-mode...?

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



newforms-stability, django0.96

2007-06-21 Thread Gábor Farkas

hi,

i have to add some forms to our django0.96-using application.
until now i used oldforms. are the newforms the recommended way to go 
with django0.96?

thanks,
gabor

--~--~-~--~~~---~--~~
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: Mysql sleeping queries

2007-06-19 Thread Gábor Farkas

David Reynolds wrote:
> Malcolm,
> 
> On 19 Jun 2007, at 8:09 am, Malcolm Tredinnick wrote:
> 
>> It would be interesting to know if anything prior to [5482] (that's
>> 5482, not 5492) works. There was a very large change in [5482] that
>> should be mostly invisible but may have some side-effects we need to be
>> aware of.
> 
> Thanks for your advice - I went back to 5481, which seems to have 
> cleared it up.

i'm glad this fixed your problem, but please note that:

from the information you provided, we know that 5481 works, but 5492 
does not. but this does not mean that 5481 broke it. there are still 10 
revisions (starting with 5482 and ending with 5491) which might or might 
not work.

so if you have the possibility, please try to investigate which exact 
revision broke it for you.

a simple binary search would work, like..try the "version in the middle" 
(5486). if works, then 5499, if does not work then 5484 etc.

gabor

--~--~-~--~~~---~--~~
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: WYSIWYG-editior in django

2007-06-19 Thread Gábor Farkas

yarovit wrote:
> Hello. How to connect FCKeditor to django?
> 

there is some documentation about how to use the Dojo and the TinyMCE 
wysiwyg editors with django, maybe those help.

go to code.djangoproject.com, search for "wysiwyg", and you should get 
the relevant links.

gabor

--~--~-~--~~~---~--~~
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: Mysql sleeping queries

2007-06-18 Thread Gábor Farkas

David Reynolds wrote:
> Morning,
> 
> We are experiencing a problem with Mysql with django.  Since an svn up 
> yesterday (which seems to be revision 5492) we have lots of sleeping 
> (hanging) mysql processes and we keep hitting our limit of processes 
> (which we weren't doing before). Anyone have any idea why it may be 
> doing this?
> 
> Versions:
> 
> apache 2.0.54
> mysql 4.0.24
> mysqldb 1.2.1c2-1
> 
> If anyone can shed any light, I'd be very interested to know.
> 

hi,

i have no idea what went wrong, but to the developers it certainly would 
  help, if you could find out exactly which revision broke the mysql 
behaviour.

gabor

--~--~-~--~~~---~--~~
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: recommendations for hosts

2007-06-18 Thread Gábor Farkas

shabda wrote:
> Hi,
> 
> What host do you people recommend for hosting a small-medium traffic
> django site. Its just a hobby hobby site so I dont want too costly a
> host, but since this is the first django app I would be hosting, I
> would prefer a host with reasonable support and one which specialises
> in django.
> 

i cannot recommend to you anything specific, but for a list of 
django-hosts, check this page:

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

gabor

--~--~-~--~~~---~--~~
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: User profile views - Does something like this make sense?

2007-06-18 Thread Gábor Farkas

zenx wrote:
> I want to show the user the latest users that have seen his profile.
> So everytime a logged user views another user's profile a ProfieView
> object is stored in the database (or the date is updated if the user
> that is viewing the profile has already viewed it before). I know this
> can make the database grow too much, so I think I can run a cron
> script daily that deletes all profile views older than a week (see
> clear_old method). I don't know if the code is 100% correct, but is
> the concept ok? Does it make sense to add a new object to the database
> everytime another user views a profile?
> 
> 
> class ProfileViews(models.Model):
> user = models.ForeignKey(User,related_name='latest_profile_views')
> viewer = models.ForeignKey(User)
> date = models.DateTimeField()
> 
> def clear_old(self):
> d = datetime.now()-timedelta(weeks=1)
> p = ProfileViews.objects.filter(date__lte=d)
> p.delete()
> 

i think this approach makes sense.

the only change i would recommend is to make "clear_old" into a static 
method.


gabor

--~--~-~--~~~---~--~~
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: get subversion revision-number in a django-project

2007-06-16 Thread Gábor Farkas

Udi wrote:
> Mind if I ask why?
> 

i've got the idea from here: 
http://www.thinkvitamin.com/features/webapps/serving-javascript-fast

the idea is that you serve all your media files (js/css/png/jpg)
at urls that contain for example the svn version number,
like:

/media/1432/js/form.js

and you setup your webserver to send such headers along the file
which says that the file does not need to be re-fetched for a very long 
time (let's say a year).

and when you release a new version of your program,
then, because the version-number has changed, all your media-urls change.
but it's much better described in the article.


btw. for the reference, i abandoned the "svnversion" approach.
it produces some funny version numbers when you use svn:externals,
so i went with "svn info" and extracting the version-number from there.

and, for now i decided that i will not do it at the startup, but will do 
it at release-time (so i will extract the version-number at the 
release-time, save it to let's say revision.py, and import it into 
settings.py).

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



get subversion revision-number in a django-project

2007-06-15 Thread Gábor Farkas

hi,

in my project i need to get the svn-revision-number of the project somehow.

in other words, i need to be able to find out my project's revision 
number in python

(i am not talking about django's revision-number. i'm talking about my 
own revision number)


the best way i could find is to execute "svnversion" and get it's output.
i'm planning to do this in settings.py is there a better way?

thanks,
gabor

--~--~-~--~~~---~--~~
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: json serializing without certain fields

2007-06-01 Thread Gábor Farkas

web-junkie wrote:
> Hi
> how can I get JSON out of my Django object without having certain
> fields in there for obvious reasons?
> I found solutions like serializers.serialize("json",
> Something.objects.all(), fields='myfield' )
> which do not work, there's also a ticket on that 
> http://code.djangoproject.com/ticket/3466
> Why isn't that solved by now and how can I get it to work the way I
> want?

you can always write your own serializer... check how the json one is 
done...

gabor

--~--~-~--~~~---~--~~
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: Too many queries generated by ChangeManipulator

2007-06-01 Thread Gábor Farkas

Russell Keith-Magee wrote:
> On 6/1/07, char <[EMAIL PROTECTED]> wrote:
>> Obviously, the performance deteriorates rapidly as the number of
>> GamesOfInterest added to a Profile increases. Is there any way to
>> avoid this?
> 
> This is a known problem, and one of the many reasons that the forms
> framework is being replaced with 'newforms'.
> 
> There is no workaround (that I am aware of), nor are there plans to
> fix the (many) problems with the Manipulator framework.
> 
> If you are developing a new application, I _strongly_ recommend that
> you develop using newforms.
> 

it's probably still too early in the morning, but cannot this be worked 
around by using raw_id_admin?

(just a quick test where i added raw_id_admin to most of the foreignkeys 
seems to have fixed the issue (but i am not sure if you can keep all the 
other admin-options))

gabor

--~--~-~--~~~---~--~~
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: Checking group permissions in template code

2007-05-31 Thread Gábor Farkas

vida wrote:
> After reading the docs and looking for posts relating this problem
> here and in .developers, I found no "standard" way of checking for a
> user's group permissions in the templates.
> 
> So what I did is to add the following method to auth.models.User
> (yeah, yeah, it *should* be in appname.models.UserProfile):
> 
> def group_permissions(self):
> class GroupPermissions:
> def __init__(self, permissions):
> for perm in permissions:
> setattr(self, perm, True)
> 
> def __str__(self):
> return 'The user belongs to the following groups: %s' % \
> ', '.join([k for k, v in self.__dict__.iteritems()])
> 
> return GroupPermissions(self.get_group_permissions())
> 
> 
> which lets me write something like the following in my templates:
> {% if user.group_permissions.permission_name %} draw custom menues for
> this particular group here {% endif %}
> 
> So, is there already a way to do this and I missed it? If not, given
> that it is apparently not advisable (is it?) to extend the
> auth.models.User class, how about we add it?

maybe i'm missing something here, but is it really important for you to 
use only through-a-group gained permissions?

isn't it enough to simply check for the given permission?
because if it's enough, then simply use the "perms" variable in the 
templates.


gabor

--~--~-~--~~~---~--~~
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: single-sign-on

2007-05-30 Thread Gábor Farkas

David Larlet wrote:
> 2007/5/29, Gábor Farkas <[EMAIL PROTECTED]>:
>> hi,
>>
>> i probably will have to implement a single-sign-on (SSO) solution for
>> several django-based intranet web-applications.
>>
>> i looked into the mailing list archives, and found this:
>>
>> http://blog.case.edu/bmb12/2006/12/cas_for_django_part_2
>>
>> it uses CAS (http://en.wikipedia.org/wiki/Central_Authentication_Service).
>>
>> my question is:
>>
>> did anyone else implement a SSO solution in django?
>>
> 
> There is the OpenID implementation of Simon Willison here:
> http://simonwillison.net/2007/Apr/24/openidconsumer/

thanks for the idea.

i knew about OpenID, but because the thing i will have to implement will 
be used only inside the company, i somehow thought OpenID might not be 
what i need. but now that i think more about it, it may be suitable.

thanks,
gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



single-sign-on

2007-05-29 Thread Gábor Farkas

hi,

i probably will have to implement a single-sign-on (SSO) solution for 
several django-based intranet web-applications.

i looked into the mailing list archives, and found this:

http://blog.case.edu/bmb12/2006/12/cas_for_django_part_2

it uses CAS (http://en.wikipedia.org/wiki/Central_Authentication_Service).

my question is:

did anyone else implement a SSO solution in django?

because there are a lot of different approaches, this wikipedia page 
(http://en.wikipedia.org/wiki/Single_sign_on) lists a bunch of them.

so i'm looking for some recommendations which one to use, or, which one 
not-to-use.

thanks,
gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



non-cascading delete?

2007-04-19 Thread Gábor Farkas

hi,

i'm trying to somehow limit my users to non-cascading deletes.

the problem is the following:

when you delete() something in django, it deletes also all the related 
objects.

i do not want this. i'd like to find a way,
which TRIES to delete the object, and if not possible 
(foreign-key-restrictions), then raises an exception.

i looked at the delete() method's implementation in 
django.db.models.base, and it seems that it first collects all the 
related-objects using _collect_sub_objects, and then deletes them using 
delete_objects().

so my first idea is that i call delete_objects directly from my model's 
delete() method, but it seems that delete_objects also does some 
find-friends checks, so i'm not sure if it's "safe" or not. will have to 
investigate it more.

did anyone try something like this? is there perhaps a better/simpler way?

thanks,
gabor

--~--~-~--~~~---~--~~
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: cyrillic text garbled if used as question in polls example

2006-12-11 Thread Gábor Farkas

Anton Daneika wrote:
> Well, I tried this conf modification.
> Before it I could do
> mysql> insert into polls_poll  (`question`, `pub_date`) values ('Часто 
> ли у вас возникают проблемы с кирилицей?', NOW());
> 
> Then the select statement would produce a correct cyrillic output, but 
> after the proposed conf modification I get garbled text in mysql client...

:)

welcome to the wonderful world of charsets :)

(sorry, i have no idea how this works in mysql(i'm a postgresql user), 
but if you see it garbled in mysql-client, that does not mean things got 
wrong... unfortunately there are many-many factors that may affect these 
things)

so, good luck, and don't give up :)

gabor

--~--~-~--~~~---~--~~
 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: forcing UTF8 data inside django

2006-12-11 Thread Gábor Farkas

Victor Ng wrote:
> Hi all,
> 
> The unicode problem seems to creep up in this list a lot, so here's
> what I've done to solve my problems.
> 
> My particular problem is that I need to be able to deal with Unicode
> data in the URLs as well as the regular request GET/POST data.
> 
> This is a piece of middleware that I'm using to force all incoming
> data to be UTF-8.  If you also add in a meta tag in your head section
> of your template to declare  utf-8, I think IE will actually do the
> right thing and not do it's weird charset guessing.
> 

hi,

well, from my experiences, the most important thing is the content-type 
http header. if you explicitly tell there the charset, then the browser 
will use that, and completely ignore the charset-specification in the 
html file.

also, may i ask, why such a paranoid way of working with GET/POST?
because (also, only my experience, no big testing), the browsers submit 
their form-data in the charset in which the page containing the form was.

so if you send to the browser an utf-8 page, it's submitted data is 
going to be utf-8.


gabor

--~--~-~--~~~---~--~~
 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: Django + FastCGI Problems

2006-11-28 Thread Gábor Farkas

Uros Trebec wrote:
> On Nov 27, 6:55 pm, "Uros Trebec" <[EMAIL PROTECTED]> wrote:
> 
>> ATM, if I go to "http://localhost:8484/django.fcgi; I only get "403
>> Forbidden" response.
> 
> OK, nevermind... I had to run "django-fcgi.py" too.
> http://manuals.textdrive.com/read/book/15
> 
>> Now, how do I get Apache to redirect all requests to my lighttpd server?
> 
> On the other hand, this seams to be impossible without mod_proxy. Or is
> it?

imho it's not possible without mod_proxy.

and btw, regarding long-running stuff, check this:
http://blog.dreamhosters.com/kbase/index.cgi?area=3079

gabor


--~--~-~--~~~---~--~~
 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: Django or TurboGears for a new survery application?

2006-11-05 Thread Gábor Farkas

Matt Culbreth wrote:
> Hello Friends,
> 
> I'm beginning a new project for a client and I'm going to use either
> Django or TurboGears.  I'd like to get some feedback from this group on
> the direction I should take.
> 
>
 > 
 >
> So, based on this, my initial leaning had been to go to TurboGears.  My
> thoughts were that the application is not interested in content
> management or display, and that I'd like to use a bit of AJAX goodies
> here and there.

hi,

could you tell us how is it easier to do AJAX in turbogears than it's in 
django?

gabor

--~--~-~--~~~---~--~~
 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: Index of an item in a QuerySet

2006-11-01 Thread Gábor Farkas

Frankie Robertson wrote:
> On 01/11/06, Gábor Farkas <[EMAIL PROTECTED]> wrote:
>> samuel wrote:
>>>>> I'm probably just not seeing it, but how do  I go about getting the
>>>>> index of an item in a query set? I.E., this article is the Xth article
>>>>> in this queryset of articles sorted by date.
>>>> If you're looping through them in the template with the 'for' tag,
>>>> each time through the loop you'll have access to a variable called
>>>> 'forloop.counter' which has this information; the first time through
>>>> it will be 1, the second time it will be 2, and so on.
>>>>
>>>> See http://www.djangoproject.com/documentation/templates/#for for details.
>>>>
>>> Thanks but I guess I'm looking for something a bit different. Here's
>>> exactly what I'm trying to do: I have  articles that are chunked into
>>> groups of 10 arbitrarily based on their date. So when a new article is
>>> added the groups change. When you go to an article page, I want to
>>> display the chunk that the article belongs to. So if the article is
>>> 19th, display a list of articles 11-20.
>>>
>>> If I'm thinking through this correctly, I need to know the articles
>>> location in the queryset before I get to the template and then slice
>>> the queryset as necessary. How would I go about this? Just iterate
>>> through and backtrack when I get there?
>>>
>> if the number of articles is not too high, then simply generate their
>> number in the view... like:
>>
>> queryset = Article.objects.all()
>>
>> items = list(enumerate(queryset))
>>
>> which is basically the same as:
>>
>> items = zip (range(queryset.count()), queryset)
>>
>> or, if you want it 1-based and not 0-based:
>>
>> items = zip (range(1,queryset.count()+1), queryset)
>>
>> the problem with these is that it fetches all the article-objects.
> 
> Since the only way to do this is programmatically in python it might
> be better to use raw sql for this instead.
> 

hmm.. how?

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Index of an item in a QuerySet

2006-11-01 Thread Gábor Farkas

samuel wrote:
>>> I'm probably just not seeing it, but how do  I go about getting the
>>> index of an item in a query set? I.E., this article is the Xth article
>>> in this queryset of articles sorted by date.
>> If you're looping through them in the template with the 'for' tag,
>> each time through the loop you'll have access to a variable called
>> 'forloop.counter' which has this information; the first time through
>> it will be 1, the second time it will be 2, and so on.
>>
>> See http://www.djangoproject.com/documentation/templates/#for for details.
>>
> 
> Thanks but I guess I'm looking for something a bit different. Here's
> exactly what I'm trying to do: I have  articles that are chunked into
> groups of 10 arbitrarily based on their date. So when a new article is
> added the groups change. When you go to an article page, I want to
> display the chunk that the article belongs to. So if the article is
> 19th, display a list of articles 11-20.
> 
> If I'm thinking through this correctly, I need to know the articles
> location in the queryset before I get to the template and then slice
> the queryset as necessary. How would I go about this? Just iterate
> through and backtrack when I get there?
> 

if the number of articles is not too high, then simply generate their 
number in the view... like:

queryset = Article.objects.all()

items = list(enumerate(queryset))

which is basically the same as:

items = zip (range(queryset.count()), queryset)

or, if you want it 1-based and not 0-based:

items = zip (range(1,queryset.count()+1), queryset)

the problem with these is that it fetches all the article-objects.

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: postresql: CREATE UNIQUE INDEX unnecessary (duplicate)?

2006-10-25 Thread Gábor Farkas

Kenneth Gonsalves wrote:
> 
> On 25-Oct-06, at 4:06 PM, Kenneth Gonsalves wrote:
> 
>>> hmmm.. which db version?
>> postgresql 7.4.x on debian sarge
> 
> and to add - my sqlall does not create an index for unique=True. It  
> leaves it to postgresql
> 

maybe it's a misunderstanding...

it also does not create an index for unique=True for me.
it creates the index for the db_index = True (which is implied by the 
SlugField).

so, to be sure we're talking about the same thing:

you tried the same model?

could you post here your "manage.py sqlall"?

thanks,
gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: postresql: CREATE UNIQUE INDEX unnecessary (duplicate)?

2006-10-25 Thread Gábor Farkas

Kenneth Gonsalves wrote:
> 
> On 25-Oct-06, at 3:21 PM, Gábor Farkas wrote:
> 
>> ===
>> Indexes:
>>  "fileman_filemanager_pkey" PRIMARY KEY, btree (id)
>>  "fileman_filemanager_name" UNIQUE, btree (name)
>>  "fileman_filemanager_name_key" UNIQUE, btree (name)
>> ===
>>
>> from what it looks like, the last 2 indexes are basically the same.
> 
> i checked one of my databases - only two indexes are created and not  
> three
> 

hmmm.. which db version?

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



postresql: CREATE UNIQUE INDEX unnecessary (duplicate)?

2006-10-25 Thread Gábor Farkas

hi,

imagine the following model:

===
class FileManager(Model):
 name = SlugField(maxlength=100,unique=True)
 directory = CharField(maxlength=500)
=

the sqlall for it looks like this:



==
BEGIN;
CREATE TABLE "fileman_filemanager" (
 "id" serial NOT NULL PRIMARY KEY,
 "name" varchar(100) NOT NULL UNIQUE,
 "directory" varchar(500) NOT NULL
);
CREATE UNIQUE INDEX fileman_filemanager_name ON "fileman_filemanager" 
("name");
COMMIT;
===


now, when you feed it to postgresql, he will auto-create an unique index 
for the name-field, simply because it's UNIQUE.

so at the end, the following indexes will be created:be:

===
Indexes:
 "fileman_filemanager_pkey" PRIMARY KEY, btree (id)
 "fileman_filemanager_name" UNIQUE, btree (name)
 "fileman_filemanager_name_key" UNIQUE, btree (name)
===

from what it looks like, the last 2 indexes are basically the same.

i understand why django create the index ( because the SlugField implies 
db_index = True), but maybe it should not create it for UNIQUE fields?


gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Best configuration for small VPS

2006-10-25 Thread Gábor Farkas

orestis wrote:
> Anyway, I'm interested in minimizing memory usage. 
 >
 >
> 
> I'll have to figure out why I have 10 mysqld instances eating 45M out
> of 64M of memory.


maybe you could try to use sqlite as the database?

(no idea about it's memory usage, but i would expect it to be smaller 
than mysql/postgres)

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



long-running process. how to do it?

2006-10-05 Thread Gábor Farkas

hi,

i have the following "problem".

in my django app, at some point i have to send out a LOT of emails 
(several thousand).

this sending takes a long time, so an usual web based approach (click 
the send-button, send the mail, and show the response to the user) does 
not work, because the browser usually timeouts the connection, and 
generally the waiting time is too long.

so, how to handle this?

my idea is/was to spawn a separate process (i'm on linux), which will do 
the mail sending, and then report somehow to the user the completion (by 
email, or by having a results-web-page in the django-app, which the user 
can visit, and check the progress...)...

so, are there any other, more elegant/simpler solutions?

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Unicode and django/db/backends/util.py

2006-10-04 Thread Gábor Farkas

Malcolm Tredinnick wrote:
> On Tue, 2006-10-03 at 22:26 -0700, Beau Hartshorne wrote:
>> On 3-Oct-06, at 7:36 PM, Malcolm Tredinnick wrote:
>>
>>> So this is the value that the string has right at the moment the
>>> exception occurs? Can you paste the traceback you see, please (and
>>> preferably the value of 'sql' and 'params' at that point as well).
>>>
>>> I'm a bit in the dark about what is happening right now, since
>>> subsituting a UTF-8 string into a Python string should work easily.
>>>
>> s = unicode('Djang\xc3\xa9', 'utf-8')
>> print "update foo set blah = '%s'" % s
>>> update foo set blah = 'Djangé'
>>>
>>> is an example of what should be happening. I suspect there is  
>>> something
>>> else important about what you are doing. Not accusing you of
>>> deliberately misleading or anything -- I have no idea what the  
>>> important
>>> thing is yet, either.
>> Actually, this is what I get:
>>
>>  >>> import sys
>>  >>> print sys.version
>> 2.4.3 (#1, Mar 30 2006, 11:02:16)
>> [GCC 4.0.1 (Apple Computer, Inc. build 5250)]
>>
>>  >>> s = unicode('Djang\xc3\xa9', 'utf-8')
>>  >>> print "update foo set blah = '%s'" % s
>> Traceback (most recent call last):
>>File "", line 1, in ?
>> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in  
>> position 28: ordinal not in range(128)
>>
>> But, if I do this:
>>
>>  >>> s = 'Djang\xc3\xa9'
>>  >>> print "update foo set blah = '%s'" % s
>> update foo set blah = 'Djangé'
>>
>> I haven't played with the default encoding at all.
> 
> Oh sod :-( It's also an environment locale thing. My system typically
> runs in en_AU.UTF-8 (so UTF-8 by default). If I run in the "C" or "en"
> locales, I get the same thing.
> 
> So, yeah, it looks like you have to run s.encode('utf-8') on your
> strings before trying to work with them in that case.
> 


explicit is better than implicit :)

well, this actual problem here is only because the "print", which uses 
the locale. the locale is not used when conversions happen "inside" of 
python.

but still, imho it's a very bad idea to pass unicode strings to the db 
layer in current django. they should all be converted into bytestring 
before sending them to the db... for example, psycopg1 does not quote 
unicode-strings correctly...


gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: "slice" xhtml content and keep it valid xhtml?

2006-09-27 Thread Gábor Farkas

Luke Plant wrote:
> On Wednesday 27 September 2006 08:09, Gábor Farkas wrote:
> 
>> i have the following problem:
>>
>>
>> in a page-template, i have to display the first 100 characters of
>> some html content.
>>
>> the problem is, that if i simply slice the html-content as if it were
>> plaintext, then sometimes some tags get cut in the half etc...
>>
>> so, is there a way to do this slicing without losing html-validness?
> 
> What if your 100 characters stops with some tag still open, or multiple 
> tags still open -- e.g. in the middle of a cell of a table?  In 
> general, you can't solve this.  How should those tags be closed again?  
> You could in theory have a naive solution that just closes all opens 
> tags, but there's no guarantee this will be appropriate.
> 

i should have explained my situation in more detail, sorry..

actually the html that i'm slicing is more like "rich text"... mostly 
plaintext + some a_hrefs and maybe bold/italic/whatever. so no tables 
and divs and such... so a naive approach is enough for me.

will try to look at the solution in ticket #2027.

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



SlugField is not unique?

2006-09-27 Thread Gábor Farkas

hi,

i've just checked and SlugField does not imply unique=True.

i somehow always assumed that it does.

so before i go and add the unique=True to all my SlugFields,

is there any reason to have non-unique SlugFields?

as far as i understand, SlugFields are mostly used in URLs which 
imho implies that they need to be unique...


gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



"slice" xhtml content and keep it valid xhtml?

2006-09-27 Thread Gábor Farkas

hi,

i have the following problem:


in a page-template, i have to display the first 100 characters of some 
html content.

the problem is, that if i simply slice the html-content as if it were 
plaintext, then sometimes some tags get cut in the half etc...

so, is there a way to do this slicing without losing html-validness?

or perhaps, is there some library, that "fixes" invalid (x)html?

thanks,
gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



get the content-type in a template?

2006-09-26 Thread Gábor Farkas

hi,

i many times use the object's content-type's "model" attribute,
when generating URLs for certain actions.

and i many times need to get the given object's content-type
in the template.

unfortunately i haven't found any way to do it, so i:

- either do it in the view
- or i add a content-type property to every model of mine

are there any other ideas how to do it?

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: HTTP response-code for missing querystring?

2006-09-22 Thread Gábor Farkas

Malcolm Tredinnick wrote:
> On Fri, 2006-09-22 at 15:28 +0200, Gábor Farkas wrote:
> [...]
>> in this case, technically the user should not be able to have the url 
>> without the querystring, except if he is playing with the url :)
>>
>> i mean "what is the most standard-conformant and correct response"?
>>
>> http-404 certainly not imho.
> 
> 404 is not unreasonable. "Resource not found" is certainly an acceptable
> response here, since there was no resource to find. It's also reasonable
> to use 404 for "nothing here" when you don't want to give the reason (as
> per the RFC).
> 
>> http-500 seems also wrong, because there was no unexpected error in the 
>> server.
> 
> Your server didn't have an error. So, no.
> 
>> http-400 bad request maybe?
> 
> I would use 403 (forbidden) or 404. Note that, as per the RFC, 403
> responses indicate that authorization will not help and the request
> should not be repeated unchanged. You can even put something like "quit
> screwing around with the query string" -- or other message -- in the
> body if you like (for a 403).
> 

and again i learned something...

somehow i always assumed that 403 is tied to http-authentication, but 
now, (after this email, and reading (again) the rfc), i see that it does 
not "depend" on authorization at all, in fact, it's saying it will not 
help. interesting.

thanks,

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



HTTP response-code for missing querystring?

2006-09-22 Thread Gábor Farkas

hi,

imagine that you have a view function, that requires a parameter in the 
querystring.

for example, it needs to have:

http://foo.com/bla/?param=15

now, what should happen if it gets:

http://foo.com/bla/

?

in this case, technically the user should not be able to have the url 
without the querystring, except if he is playing with the url :)

i mean "what is the most standard-conformant and correct response"?

http-404 certainly not imho.
http-500 seems also wrong, because there was no unexpected error in the 
server.

http-400 bad request maybe?


simply returning a http-200 with an error page seems to be the wrong 
thing to do.


gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



non-cascading delete?

2006-09-12 Thread Gábor Farkas

hi,

as far as i understand,

when you delete an object in django, it also deletes all the objects 
that reference it.

is there a way to only delete the object, and get an exception if other 
objects reference it?


thanks,
gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Dojo Editor2 invocation from Django

2006-09-06 Thread Gábor Farkas

Gloria wrote:
> Hi there. I found this nifty when I searched for Django and Dojo:
> 
> http://code.djangoproject.com/wiki/AddDojoEditor
> 
> The thread on this link is closed, so I am starting a new one.
> 
> Please explain how I invoke this code. I am fairly new to Django, and
> I've avoided javascript like the plague over the years, but I
> understand the constructs.
> 
> This example explains the model and the media interface. But how do I
> invoke this piece of js code from within my view?
> 
> Thanks for tolerating neophyte questions here.
> 

hi,

that webpage is explaining how to add Editor2 to the 
django-admin-application (the one that's usuallay at http://foo.com/admin).

if you want to add it to your own code,
then simply read the documentation on the dojo 'side', and act accordingly.

it does not have to do anything with django.

for example, simply adjust your html-template to be suitable for the 
Editor2 widget, and all should work. no changes to the django-views 
should be necessary.

if it does not work, just come back here, show us the non-working code, 
and we'll help (if we can) :)


gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: foreignKey + manipulator...performance problem, SOLVED

2006-08-31 Thread Gábor Farkas

[EMAIL PROTECTED] wrote:
> What do you mean with "2000 thing objects"? Are there 2000 records in
> the database for that table, or did you have 2000 records in memory at
> runtime?
> 

if you don't use raw_id_admin, then (from my understanding at least),
the manipulator loads all of them into the memory.
so you have all the objects from the database-table in the memory.

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Unicode, unicode, more unicode

2006-08-25 Thread Gábor Farkas

Sean Schertell wrote:
> Fweeew!!! 
> 
> That's really good news. I'd have been really disappointed if I  
> couldn't do these sites in django. Hooray!
> 

yes, as others already said,

if you do not need to "work with" those strings,
you can just set everything (page-templates, database) to utf-8,
and everything will be ok.

but when you will need to manipulate the strings, (like convert to 
uppercase, count the characters, strip them to a fixed length, etc.), 
you will have to convert them first to unicode (u'foo'.decode('utf-8')), 
do the manipulation, and then , when you send the data back to django, 
convert them back to utf-8 ( 'foo'.encode('utf-8')).

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Django 0.95 on Dreamhost

2006-08-24 Thread Gábor Farkas

Apple wrote:
>> hmm.. let's try the following.
>>
>> 1. take the 2 files attached to this email.
>>
>> 2. put them to some folder on dreamhost that's accessible from the outside.
>>
>> 3. now go to that folder using your browser.
>>
>> 4. click on the test.fcgi file
>>
>>
>> does it work?
>>
>> gabor
> 
> I have tried your method it didn't seem to work...  both files are
> chmod to 755, and the site is fcgi enabled.  This is quite strange
> really.   Iook at the error log it generated these errors (probably
> only the first two are worth taking notes of):


hi,

i think now would be a good time to ask the dreamhost-support. after 
all, here you only used a simple python fastcgi app, and as far as i 
understand, they support fastcgi.

they might not support officially Django, but this little fastcgi app 
simply must work. so simply ask them.

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Django 0.95 on Dreamhost

2006-08-16 Thread Gábor Farkas
Apple wrote:
> 
>> generally this means that you should put in some url-rewriting...
> 
> Do you mean url rewriting in my url.py or in my .htacess?
> 
> I've tried removing the .htacess file and directly accessing the fcgi
> file.  It still generates a 500 Error.  At this point I have not a clue
> what this error implicates or what might have caused it.  Anybody know?
>  Any help or pointers will be much appreciated!
> 
hmm.. let's try the following.

1. take the 2 files attached to this email.

2. put them to some folder on dreamhost that's accessible from the outside.

3. now go to that folder using your browser.

4. click on the test.fcgi file


does it work?

gabor


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
# Copyright (c) 2002, 2003, 2005 Allan Saddi <[EMAIL PROTECTED]>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#notice, this list of conditions and the following disclaimer in the
#documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $Id: fcgi.py 1828 2005-11-28 17:17:29Z asaddi $

"""
fcgi - a FastCGI/WSGI gateway.

For more information about FastCGI, see .

For more information about the Web Server Gateway Interface, see
.

Example usage:

  #!/usr/bin/env python
  from myapplication import app # Assume app is your WSGI application object
  from fcgi import WSGIServer
  WSGIServer(app).run()

See the documentation for WSGIServer/Server for more information.

On most platforms, fcgi will fallback to regular CGI behavior if run in a
non-FastCGI context. If you want to force CGI behavior, set the environment
variable FCGI_FORCE_CGI to "Y" or "y".
"""

__author__ = 'Allan Saddi <[EMAIL PROTECTED]>'
__version__ = '$Revision: 1828 $'

import sys
import os
import signal
import struct
import cStringIO as StringIO
import select
import socket
import errno
import traceback

try:
import thread
import threading
thread_available = True
except ImportError:
import dummy_thread as thread
import dummy_threading as threading
thread_available = False

# Apparently 2.3 doesn't define SHUT_WR? Assume it is 1 in this case.
if not hasattr(socket, 'SHUT_WR'):
socket.SHUT_WR = 1

__all__ = ['WSGIServer']

# Constants from the spec.
FCGI_LISTENSOCK_FILENO = 0

FCGI_HEADER_LEN = 8

FCGI_VERSION_1 = 1

FCGI_BEGIN_REQUEST = 1
FCGI_ABORT_REQUEST = 2
FCGI_END_REQUEST = 3
FCGI_PARAMS = 4
FCGI_STDIN = 5
FCGI_STDOUT = 6
FCGI_STDERR = 7
FCGI_DATA = 8
FCGI_GET_VALUES = 9
FCGI_GET_VALUES_RESULT = 10
FCGI_UNKNOWN_TYPE = 11
FCGI_MAXTYPE = FCGI_UNKNOWN_TYPE

FCGI_NULL_REQUEST_ID = 0

FCGI_KEEP_CONN = 1

FCGI_RESPONDER = 1
FCGI_AUTHORIZER = 2
FCGI_FILTER = 3

FCGI_REQUEST_COMPLETE = 0
FCGI_CANT_MPX_CONN = 1
FCGI_OVERLOADED = 2
FCGI_UNKNOWN_ROLE = 3

FCGI_MAX_CONNS = 'FCGI_MAX_CONNS'
FCGI_MAX_REQS = 'FCGI_MAX_REQS'
FCGI_MPXS_CONNS = 'FCGI_MPXS_CONNS'

FCGI_Header = '!BBHHBx'
FCGI_BeginRequestBody = '!HB5x'
FCGI_EndRequestBody = '!LB3x'
FCGI_UnknownTypeBody = '!B7x'

FCGI_EndRequestBody_LEN = struct.calcsize(FCGI_EndRequestBody)
FCGI_UnknownTypeBody_LEN = struct.calcsize(FCGI_UnknownTypeBody)

if __debug__:
import time

# Set non-zero to write debug output to a file.
DEBUG = 0
DEBUGLOG = '/tmp/fcgi.log'

def _debug(level, msg):
if DEBUG < level:
return

try:
f = open(DEBUGLOG, 'a')
f.write('%sfcgi: %s\n' % (time.ctime()[4:-4], msg))
f.close()
except:
pass

class 

Re: Django 0.95 on Dreamhost

2006-08-14 Thread Gábor Farkas

Apple wrote:
> Hi has anyone tried running Django 0.95 on Dreamhost?  I only tried to
> setup a simple project following the dreamhost's wiki.  I am getting a
> string index out of range exception on common.py:


hi,

generally this means that you should put in some url-rewriting...

just for the reference, i have a very simple django app (0.95) running 
on dreamhost without problems...

try to follow this howto:

http://www2.jeffcroft.com/2006/may/11/django-dreamhost/

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: MySQL UnicodeEncodeError

2006-08-08 Thread Gábor Farkas

Wade Leftwich wrote:
> Gábor Farkas wrote:
>> Niran Babalola wrote:
>>> I've been developing a Django application using SQLite, and now I'm
>>> trying to move over to MySQL and actually launch the site. The
>>> application is storing data from RSS/Atom feeds using Universal Feed
>>> Parser, which uses unicode strings for all its data. When I try to
>>> store information from a feed into my MySQL database, I get the
>>> following error:
>>>
>>> "UnicodeEncodeError: 'latin-1' codec can't encode characters in
>>> position 75-76: ordinal not in range(256)"
>>>
>>> Everything worked fine with SQLite, but I haven't been able to get past
>>> this problem with MySQL. I tried dropping the database and recreating
>>> it with utf8 as the default encoding, but that didn't help either. Any
>>> ideas?
>> hi,
>>
>> please give us the whole stacktrace, and the line of the code where this
>> happens.
>>
>> generally, this might happen because you're trying to directly put
>> unicode text into the database (i have no experience with mysql, so i
>> can be wrong here). the various database-backends react differently to
>> save-unicode-data (sqlite3 usually works ok, psycopg1 fails, psycopg2
>> works etc.).
>>
>> so, before saving the data, convert it explicitly to byte-strings with a
>> suitable charset (i assume you're using utf8).
>>
>> gabor
> 
> MySQL defaults to latin-1 encoding, though in version 5 you can specify
> UTF-8. So as Gabor says, you have to convert explicitly to byte-strings
> encoded so your db will accept them. From utf-8 to latin1:
> 
> def utf8tolatin1(s):
> return s.decode('utf-8', 'ignore').encode('latin1',
> 'xmlcharrefreplace')
> 
> In [8]: u'\u2014'.encode('utf-8')
> Out[8]: '\xe2\x80\x94'
> 
> In [9]: utf8tolatin1('\xe2\x80\x94')
> Out[9]: ''
> 
> Also see:
> http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html
> 

thanks for the info..

to the original-poster:
please note, that this way you might lose some character-data.. there's 
no better way, you simply cannot store every unicode character in latin1.

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: MySQL UnicodeEncodeError

2006-08-08 Thread Gábor Farkas

Niran Babalola wrote:
> I've been developing a Django application using SQLite, and now I'm
> trying to move over to MySQL and actually launch the site. The
> application is storing data from RSS/Atom feeds using Universal Feed
> Parser, which uses unicode strings for all its data. When I try to
> store information from a feed into my MySQL database, I get the
> following error:
> 
> "UnicodeEncodeError: 'latin-1' codec can't encode characters in
> position 75-76: ordinal not in range(256)"
> 
> Everything worked fine with SQLite, but I haven't been able to get past
> this problem with MySQL. I tried dropping the database and recreating
> it with utf8 as the default encoding, but that didn't help either. Any
> ideas?

hi,

please give us the whole stacktrace, and the line of the code where this 
happens.

generally, this might happen because you're trying to directly put 
unicode text into the database (i have no experience with mysql, so i 
can be wrong here). the various database-backends react differently to 
save-unicode-data (sqlite3 usually works ok, psycopg1 fails, psycopg2 
works etc.).

so, before saving the data, convert it explicitly to byte-strings with a 
suitable charset (i assume you're using utf8).

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Using custom forms with generic views

2006-08-08 Thread Gábor Farkas

jeffmikels wrote:
> Thanks for your help. I ended up creating a view to do the work. If the
> data is simple enough and just plain text, is there a compelling reason
> to use AddManipulator or other manipulators instead of just
> object.save()?
> 
> 

hi,

for example, if you want to validate that data (and more importantly, 
display a form with the error messages if something does not validate), 
then it's much easier to do using the manipulator/formwrapper mechanism.

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Is AJAX Alone Reason to Use TG?`

2006-08-03 Thread Gábor Farkas

James Bennett wrote:
> On 8/2/06, gabor <[EMAIL PROTECTED]> wrote:
>> django does not force you to use the django-templating-system (you can
>> use myghty/zope-tal/whatever instead), but it clearly recommends the
>> django-templating-system, and that's the system which is the most
>> tested/streamlined/documented/developed.
> 
> I'm not convinced that the analogy holds; to me, officially endorsing
> a particular JS toolkit would be like re-wiring the template system to
> favor a particular version of HTML. Just as the choice of HTML or
> XHTML and which version to use is best left to a case-by-case basis,
> the choice of which JS toolkit to use is best left to a case-by-case
> basis.
> 

hmm.. probably this is the point where we disagree.. which is of course 
not a bad thing.

maybe we should clarify what we mean by words like "endorse", 
"recommend", "support" etc.


and also we're probably approaching this from the wrong end (or at least 
  i).

the real question probably is:

- what would we gain by having an 'official' javascript library?

if the answer is "nothing" then we don't need an official js lib.

so, is there something that django could do to make ajax easier? (except 
the server-get-get/post-and-responds-in-json)

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: json serialization

2006-07-31 Thread Gábor Farkas

Jyrki Pulliainen wrote:
> 2006/7/31, Gábor Farkas <[EMAIL PROTECTED]>:
>>
>> datetime.datetime inherits from datetime.
>>
> 
> Definetly not
> 


sorry, of course i meant

"datetime.datetime inherits from datetime.time"

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: json serialization

2006-07-31 Thread Gábor Farkas

siniy wrote:
> Hi all,
> I've downloaded today a new release of Django and played with json
> serialization. I found that if you use DateTime field the resulting
> json string contains only date, but not all datetime. So I viewed a
> source code of django/core/serializers/json.py and found that:
> 
> def default(self, o):
> if isinstance(o, datetime.date):
> return o.strftime(self.DATE_FORMAT)
> elif isinstance(o, datetime.time):
> return o.strftime(self.TIME_FORMAT)
> elif isinstance(o, datetime.datetime):
>return o.strftime("%s %s" % (self.DATE_FORMAT,
> self.TIME_FORMAT))
>   
> 
> I know that isinstance(o, datetime.date) returns "True" even "o" is a
> datetime object. But I don't know - may be it's a python bug? My python
> version 2.4.3 from Ubuntu Dapper. So I replace parts of django code and
> all works as I want:
> 

no, it's not a bug.

datetime.datetime inherits from datetime.

you can check it like this:

 >>> datetime.datetime.__mro__
(, , )
 >>>

(mro is method-resolution-order)

as you see 'datetime' inherits from 'date', which inherits from 'object'.

and if you check the python-help, you'll see that
isinstance "Return whether an object is an instance of a class or of a 
subclass thereof".

and because datetime is a subclass of date, isinstance returns True.


maybe you could try this:

if type(o) == type(datetime.datetime):
// your code here


gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



apache, fastcgi, auto-reload?

2006-07-13 Thread Gábor Farkas

hi,

(yes, i know that the devel-server does auto-reload)

i'm using apache with fastcgi with flup with django.

is there a way to somehow have my source-code changes cause a reload? 
(so that i do not have to restart the fastcgi server (or apache) after 
every source-code change?)


thanks,
gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Django & Apache 1.x

2006-07-06 Thread Gábor Farkas

Carlos Yoder wrote:
> * Important *
> 
> Does anyone know if Django will run on a config with Apache 1.x +
> FastCGI, but without flup? At servage.net they just told me that they
> don't support flup "because of high memory usage", so I don't know
> what to do.
> 
> I'll be most obliged if anyone can clarify this quickly... thanks a lot!!!
> 

in short:

1. yes, it works without it. if you dig deep enough at 
code.djangoproject.com, i think you can find some kind of fcgi.py which 
is afaik a stripped-down flup, or something like that.
2. the servage.net's answer is stupid :)

ok, basically:

your web-server (apache1.x in this case) speaks fastcgi,

and django speaks wsgi.

now you need something that translates between them.
that's what flup does.

but, flup actually is not a service/daemon. it's simply a library.

the same way how you have to put the django source code on the server,
you also have to put the flup source code on the server. but they are 
simply running together.

for example, this is a simple python script, that acts as a fastcgi 
server using django:

==
from flup.server.fcgi_fork import WSGIServer
from django.core.handlers.wsgi import WSGIHandler

os.environ['DJANGO_SETTINGS_MODULE'] = 'cms.settings'

WSGIServer(WSGIHandler()).run()
==

as you see, the flup library is nothing special. it's just a library.

about flup's high memory usage... depending on the process/thread-model, 
flup can spawn multiple fastcgi servers (the default is 6 i think). but 
there's nothing preventing you from configuring flup to only spawn 1.

so, in other words:
from the servage.net's point of view, they will never ever see that flup 
is running there.


i hope this (chaotic) explanation helps. if not, replay :)

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Django & Apache 1.x

2006-07-04 Thread Gábor Farkas

Carlos Yoder wrote:
>>> Can anybody confirm having a Django app running under Apache 1.x +
>>> FastCGI? Is this actually a silly question, since let's say Dreamhost
>>> gives only Apache 1.x support? :-)
>> i have a website served by apache 1.x + fastcgi. no problems.
>>
>> gabor
> 
> Thank you very much, or should I say köszönöm szépan? :-)

:)

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Cutting output of flup's FastCGI server

2006-06-20 Thread Gábor Farkas

PythonistL wrote:
> Hello Ivan,
> It is intereresting.
> But why do you use/prefer FastCGI to mod_python ?
> I am asking because I used for my Django apps FastCGI with Dreamhost
> but a lot of problems - Apache server used to hang when there were a
> lot of visitors. Now I switched to mod_python and it works great.
> regards,
> L

sometimes you cannot choose :-(

i mean, were you able to run mod_python at Dreamhost?

btw. we are running a normal, commercial, released django application 
using apache + fastcgi, and it works ok (read: does not hang :-)

the only thing i'm missing is the server-status info that's available in 
apache :-(

and regarding dreamhost +fastcgi.. it might be that it's a 
dreamhost-problem, and not a fastcgi one... but i have no experience 
with dreamhost+fastcgi (yet :-)

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: going crazy: foreignkey-reverse-lookup: tests work,my code fails

2006-06-15 Thread Gábor Farkas

James Bennett wrote:
> On 6/14/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>> Yeah, sorry about that. We really need to fix this. :-(
>>
>> But it's not entirely trivial from what I remember last time I dived in
>> there.
> 
> Better to let Guido and company fix relative imports in Python,
> period. Supposed to happen soon, IIRC :)
> 

i don't think it's a problem with relative/absolute imports :-(

iirc the problem here is that when you import something from 2 different 
places, then they are 2 different things ... or something like that. it 
was a long time ago that i checked that.

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Tips for integrate pyLucene in django?

2006-06-09 Thread Gábor Farkas

Ian Holsman wrote:
> another option you might want to look at is using SolR - http:// 
> incubator.apache.org/projects/solr.html , which is a search server  
> which uses lucene.
> you could then use a regular HTTP client to communicate with it.


great, thanks for the link...

have you tried using it btw? was it ok?

gabor
> 
> On 09/06/2006, at 9:36 AM, mamcxyz wrote:
> 
>> I think that complicate a little the things...
>>
>> Any hint in how do that?
>>
>> Also, for clarity, the rule is: only ONE writer object at time can
>> acces the index.
>>
>>
> 
> 
> > 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



capistrano/switchtower python equivalent?

2006-06-06 Thread Gábor Farkas

hi,

is there something similar to Capistrano 
(http://wiki.rubyonrails.com/rails/pages/Capistrano) in python?

what i'm looking for is a tool which i can configure to do the 
release-process automatically.. mostly things like:

- checkout the newest version of the source code on all the servers
- adjust some config settings
- restart apache
- rollback to an older version

etc.

so before i start to code my custom python scripts... is there anything 
like this in python?

or, did perhaps anyone try out Capistrano with python?

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



non mod-python deployment...any experiences? (dedicated server)

2006-05-02 Thread Gábor Farkas

hi,

is anyone running django using fastcgi/scgi/lighttpd or anything else 
that is not the standard apache+mod_python configuration?

at work i will have to release a new site using django, and for various 
reasons apache2 + mod_python might not be possible.

i've heard many complaints here regarding fastcgi for example, but most 
of them came from people on shared hosting (dreamhost etc.). our django 
site will be on our own servers, so no shared-hosting problem should 
affect us.

so, are there any people running django sites using non-mod_python?
any experiences? was it stable?

thanks,
gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



"fake"/custom Package/ContentType. is it dangerous?

2006-04-18 Thread Gábor Farkas

hi,

i'm working on a django project, where 99% of the functionality is 
provided by the admin module.

but for that 1%, i have the following problem:

i have some pages, that are purely views. they are not backed by any 
django models.

but i'd like to reflect any change to them into the Recent_Actions box 
in the admin screen.

as i see, to put something into the Recent_Actions list, you have to 
create a LogEntry, which needs a ContentType entry which needs a Package 
entry.

if i create those entries with suitable names, then it works fine. i can 
create new Recent_Action entries, and when you click on them, they go to 
the correct page (with suitably chosen ContentType and Package entries).

everything seems to work fine, but i'm a little afraid of touching those 
tables (content-type and package).

can anything "bad" happen if i add custom entries to them?

for example, will not django think that the entries in those tables 
point to "real" django-models?

thanks,
gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: TEMPLATE_DIRS relative to project?

2006-04-18 Thread Gábor Farkas

Nebojsa Djordjevic wrote:
> jrs wrote:
>> Then I just exclude settings_env.py from the rsync command that posts
>> the site.  I also have my database, base_url, cache and any other
>> environment specific configuration there.  Works like a charm.
> 
> I would recommend using subversion or another version control system for 
> this, it better handles local changes to the
> files. I use my (private) subversion repository for all of my sites so all 
> changes (except local ones, path and stuff)
> are done with simple 'svn update'.
> 

maybe you might consider how capistrano (was switchtower) does this:

a new svn checkout every release-time, and they have a symlink that 
always points to the version they want to use. so when they want to go 
back to an older version, they just change the symlink.

(of course you can do the same with a svn-up, but the symlink way 
somehow feels a little cleaner to me)

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: UNICODE database API How to

2006-04-18 Thread Gábor Farkas


> =Department(department=matches[1].encode('utf-8','replace')

hi,

you can remove that ['replace']. there shouldn't be any unicode 
character that cannot be represented in utf-8, so the error-condition
for which you specify the behaviour is never going to happen.

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Djangoproject site and documentation

2006-03-23 Thread Gábor Farkas

[EMAIL PROTECTED] wrote:
> Right now I cant get access to djangoproject.com.
> 
> And, as I know, its global problem.
> 
> Is there any other place, where i get django documentation right now?

http://www.nekomancer.net/djangodoc/index.html

they're the text-version docs,

and it's only there for a day or two.. (should be enough until 
djangoprojec comes back)

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Attn. Dreamhost users

2006-03-08 Thread Gábor Farkas

Amit Upadhyay wrote:
> On 3/8/06, *PythonistL* <[EMAIL PROTECTED] > wrote:
> 
> But how can I kill ALL of them?
> One by one something like:
> kill processNumber
> ?
> 
> 
> pkill is your friend.
> 
> I use "pkill -9 python2.4" on abovenet for most code changes.
> 
> 

or use a little shell scripting, like

ps aux | grep python2.4 | awk '{print $2}' | xargs kill

or something like that..

(i have to admit, the pkill solution looks simpler :))

gabor

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: only show something(form) if javascript-enabled

2006-02-21 Thread Gábor Farkas

Brett Parker wrote:
> On Mon, Feb 20, 2006 at 10:36:38PM +, Graham King wrote:
>>   You could make the form invisible using css:
>>
>> #theFormId {
>>display: none;
>> }
>>
>>   then use Javascript to change this to display = block. If they don't 
>> have Javascript the form won't appear.
>>
>>   Or you could use Javascript to write the form out, as in:
>> 
>> document.write('
'); >> >> but the CSS version is much cleaner. >> >> And yes, you should also make sure you check the data on the server >> side, otherwise something nasty is bound to happen. > > Unfortunate side effect of the CSS method, however, is what happens when > the user isn't using a browser that supports CSS, say a text based > browser. You'll then get the form displayed, which probably isn't the > right way to go ;) > > The javascript, although not the cleanest way, is probably best for the > case that you really do not want the form to be displayed. > thanks for the help. at the end, i did the followin: - no javascript-visibility tricks - the form's submit buttons are written out using document.write - i added a tag to warn the user to enable javascript this way, if javascript is disabled, the user cannot submit the form. he can still see it, but cannot submit (so cannot break anything). gabor --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---

recommended javascript books/tutorials/howtos?

2006-02-14 Thread Gábor Farkas


hi,

i'd like to increase/enhance my javascript knowledge, which right now is 
 rather limited (zero?) :)


so, are there are books/websites you can recommend?

i'm primarily interested in the application of javascript to the 
webpages, so DOM manipulation and things like that.


of course i am also interested in learning about the object-model of 
javascript and things like that, but what i'm lacking right now is the 
knowledge about the javascript-webpage interaction.


thanks,
gabor


imagefield, admin, wrong link

2006-01-19 Thread Gábor Farkas


hi,

i have an ImageField in a model.

when i use the admin interface, everything is fine, except one thing:

the ImageField part consists of:

==
Currently: LINK
Change:  
==

and the LINK is wrong. it's content is ok, but the HREF is empty.
example:

Currently:  logos/firstlogo.png 

so when you click on it, you just get the actual page.

i thought that it should take me to the submitted file...

MEDIA_URL, MEDIA_ROOT are set up correctly.
the file gets uploaded correctly to the designated folder.

any ideas what's wrong?

thanks,
gabor


custom form, validation, is there an easier way?

2006-01-13 Thread Gábor Farkas


hi,

i am implementing a VERY simple usermanagement screen for the admin 
view. functionality:


create new user, change existing user, delete user.

for an user, the following data is "available":

username, password, groups.

so when they create/change an user, they can change the username, the 
password and the assigned groups.


the view of this is a normal view with a textfield for the username, 2 
textfields for the password, and a selectbox for the groups.



my validation needs are quite simple:
1. username: to contain only some valid characters, that no other user 
with such username exists (when creating a new user) , and it's not empty.


2. password: that only valid characters are there (or a special-string 
to detect "password unchanged"), and that both password-fields contain 
identical data


3. no restrictions on the groups selectbox.


i did not want to do the validation by myself, so i hoped there is 
something in django for this.


i found:

1. generic views (the crud oriented ones). they're nice, but they only 
works with forms that display (only?) (the whole?) model data. so in my 
 case, the 2 password textfields are problematic.


2. forms/manipulators: again, there are auto-created manipulators for 
database-models, but for my needs there is need for a custom one. yes, i 
can create a custom validator, but is that simpler than to simply do all 
the validating by myself?



yesterday i decided that i will simply do all the validation by myself, 
but today when writing the 3rd-level of an if-tree, i started to wonder 
if maybe a custom validator would be simpler :)


how do you usually approach such problems?

what's the better/best way?

thanks for the help,
gabor


Re: Django admin Chinese character problem.

2006-01-11 Thread Gábor Farkas


Jeroen Ruigrok van der Werven wrote:

For my Japanese<>Dutch dictionary project I didn't have to do anything fancy.

Only thing I had added to my base template is:



Nothing else is/was needed.


i understand you. but the code mr. Gonsales quoted did not do anything 
with the webpage (at least it seemed to be). it only read something from 
the db and that's all.


probably it's a misunderstanding.

about your dictionary project... you never went into unicode? you always 
worked with utf8-encoded bytestrings? (just curious)


gabor


Re: Django admin Chinese character problem.

2006-01-11 Thread Gábor Farkas


Kenneth Gonsalves wrote:

On Wednesday 11 Jan 2006 5:46 pm, Gábor Farkas wrote:


   event = events.get_list()[0]
   title = event.title.decode('utf8')



why do you need this? dont you set the utf8 in the template/webpage 
itself?




?

:)

if i want to work with the title, i HAVE TO decode it, or not?

or is there a way to get unicode data directly from the database-layer?

gabor


Re: Django admin Chinese character problem.

2006-01-11 Thread Gábor Farkas


Albert Lee wrote:
I use uft-8 encoding, and in admin page, when I insert a record, the 
Chinese character will become ?




hi,

i am not sure what exactly are you trying to do, here is what i did as a 
quick test.



my config:
postgresql-8.0.
database created as UNICODE (which in case of postgres means utf8)
python-2.4
psycopg-1.1.18
django-0.90

i created a very simple application.

started the admin interface,
added text with japanese characters (kanji).
saved it
then opened it again, and it was ok.

i also checked in the database, and the text entered the database correctly.

i created a simple view, and checked the database contents from it.

the text is ok, and it is in non-unicode strings using the utf8 
encoding. (so it is NOT in unicode-strings, but utf8-encoded byte-strings).


so a simple view can do for example:

def index(request):
event = events.get_list()[0]
title = event.title.decode('utf8')

//do something with title

bytestring = title.encode('utf8')
return HttpResponse(bytestring)


does this help?

bye,
gabor


Re: Django screencast

2005-12-13 Thread Gábor Farkas


Tom Dyson wrote:

I've made a short screencast which introduces some of Django's key
concepts:

http://www.throwingbeans.org/django_screencasts.html



btw. isn't it funny, that virtually all web-app screencasts (ruby on 
rails, turbogears, django) are done on mac osx? :)


i sometimes wonder if this also means that the majority of the 
users/devels use macs...


gabor


Re: Django screencast

2005-12-13 Thread Gábor Farkas


Tom Dyson wrote:

I've made a short screencast which introduces some of Django's key
concepts:

http://www.throwingbeans.org/django_screencasts.html

It's intended as a demonstration, rather than a tutorial, and in the
course of building a simple CMS in seven minutes, it covers quite a lot
of ground.

I'd be grateful for feedback, although I can't promise any quick
updates - as it says in the FAQ, "It's amazing how much time those
things take!".



fantastic!

this was really missing for django. a cool screencast..

a question: the way you pronounce 'django'..is this the 'official' way? 
or better to say is this the way most of the django users/devels 
pronounce it? (this is more a question  to the other users/devels that 
read this thread, not to the screencast-author)


i'm asking because english is not my native language, so "Django is 
pronounced zhane-go (with a long 'a')" does not help much (i have no 
idea how to pronounce 'zhane' :))



gabor


Re: how do you pronounce 'Django'

2005-09-26 Thread Gábor Farkas


Jacob Kaplan-Moss wrote:


On Sep 26, 2005, at 6:46 AM, Gábor Farkas wrote:


how do you pronounce 'Django'?



Have you checked the FAQ?

http://www.djangoproject.com/documentation/faq/#what-does-django-mean- 
and-how-do-you-pronounce-it


thanks.

;((

my second didnt-check-the-faq mistake in the last 3 days (the first was 
fink.. ) :(


gabor