Re: use of @vary_on_cookie decorator with URLconf based cache_page usage

2010-01-06 Thread Victor Lima
Off topic side note: beware if you use vary on cookie and google  
analytics, since analytics cookies changes a lot you are actually  
caching views per analytics cookie change... That bugged us for a  
while in our project.


Att,
Victor Lima

Em 05/01/2010, às 21:32, Justin L  escreveu:


For several months, we have been caching views using the URLconf
method (urls.py). An entry from urls.py is below as an example:

url(r'^(?P.*)/content/(?P[-\w]+)/$$', cache_page
(hierarchies.views.category_content_detail, CACHE_TIMEOUT),
name='category_content_detail'),

Recently, we had a need to add variance of cache based on cookie value
to support some personalization features. After reading the django
docs, it seemed easy enough to add the @vary_on_cookie decorator to
appropriate views.

@vary_on_cookie
def category_content_detail(request, path, id):
..
..

What I've noticed, is that since adding this vary decorator, the page
is no longer caching, as seen by monitoring logs and seeing many
backend processes firing which normally do not fire when the page is
cached.

Any ideas on why I'd see this behavior? My browser is setting the
cookie value appropriately, as I've monitored in Firebug, but I'm just
not seeing any sort of caching taking place. Upon removing the
vary_on_cookie decorator, caching returns to normal.

What I have noticed in testing is this. If I go back to a pure pre-
view cache setup:

@vary_on_cookie
@cache_page(60 * 15)
def category_content_detail(request, path, id):

Is there a way to use vary_on_cookie with the URLconf like setup? I
like the flexibility of the URLConf method and but also need the vary
features.

Reference:
http://docs.djangoproject.com/en/dev/topics/cache/#specifying-per-view-cache-in-the-urlconf
--
You received this message because you are subscribed to the Google  
Groups "Django users" group.

To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en 
.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Using django only for request handling work

2009-12-27 Thread Victor Lima
Restful API?

Att,
Victor Lima

Em 27/12/2009, às 18:58, Amit Sethi   
escreveu:

> Hi ,I have a project that is in general written to work with wsgi  
> server except i wish to alter some of the environ variables provided  
> to the app. So I have a function:
>
> def __call__(self, environ, start_response):   In this I want to  
> change some part of environ 
>
> So my application looks something like this
>
>
> apache server --->> django to do url handling and changing environ   
> --->>  the actual app
>
> This is my initial brainstorm . I really don't understand if it is  
> possible to do this . How do I create the same kind of interface  
> like apache or any other server i.e environ and start_response to be  
> sent to the app???
>
> -- 
> A-M-I-T S|S
> --
>
> You received this message because you are subscribed to the Google  
> Groups "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com 
> .
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en 
> .

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: AdminSite and Enterprise applications

2009-12-25 Thread Victor Lima
Well, let me put it this way: until now i have managed to extend and  
alter the admin without actually tempering with the source code to the  
level of customization that i wanted ( and it was not trivial  
customizations ). So yes the admin is highly customizable, beyond my  
expectartions. Maybe its best to explain to us the actual usability  
challenges you will have, hopefully someone has already been there

Att,
Victor Lima

Em 25/12/2009, às 09:13, Vehbi Sinan Tunalioglu   
escreveu:

> Dear All,
>
> We use Django for more than two years. Our experience is much more
> than satisfaction. However, here is a principle issue which we
> couldn't decide upon yet:
>
> Assume that you develop a mission-critical enterprise level
> application with Django (yes, we do it frequently and promote others
> doing it). Would you delegate all the back office implementation to
> AdminSite? Or would you simply go for the usual views.* functionality?
>
> The problem is that enterprise applications implement lots of business
> processes which consist of relatively complex individual business
> activities. Considering that usability is also a concern, our
> confidence to AdminSite needs to be restored for us to use it.
>
> We suppose that this is theoretically possible. But how about
> principles? What do you think?
>
> Thanks in advance.
>
> Kind regards,
> --
> vst
>
> --
>
> You received this message because you are subscribed to the Google  
> Groups "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com 
> .
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en 
> .
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: about django model save

2009-12-25 Thread Victor Lima
Try deleting the table and then syncdb again...

Att,
Victor Lima

Em 25/12/2009, às 00:02, chen gang  escreveu:

> Hi,
> I am really new to this tool... and need you help about this issue,
> thanks in advance!
>
> I create models.py like this,
>
> ...
> class Sms_detailed(models.Model):
>group = models.CharField(max_length=15)
>phone_num = models.CharField(max_length=15)
>IMEI  = models.CharField(max_length=15)
>sw_ver= models.CharField(max_length=20)
>project   = models.CharField(max_length=10)
>sw_checksum = models.CharField(max_length=10)
>recv_date_time = models.DateTimeField()
>raw_data = models.CharField(max_length=30)  # raw reset data
> ...
>
> Then create the db
> [gac...@pipi autosms]$ python manage.py sql asms
> BEGIN;
> 
> CREATE TABLE "asms_sms_detailed" (
>"id" integer NOT NULL PRIMARY KEY,
>"group" varchar(15) NOT NULL,
>"phone_num" varchar(15) NOT NULL,
>"IMEI" varchar(15) NOT NULL,
>"sw_ver" varchar(20) NOT NULL,
>"project" varchar(10) NOT NULL,
>"sw_checksum" varchar(10) NOT NULL,
>"recv_date_time" datetime NOT NULL,
>"raw_data" varchar(30) NOT NULL
> )
> ;
> ...
> COMMIT;
>
> but when I am trying to save a object,
> sms_detailed = Sms_detailed(group='test',phone_num =
> '123456'
> ,IMEI=
> '1234'
> ,sw_ver=
> '3.03'
> ,sw_checksum=
> '1234',project='rh-125',recv_date_time=datetime.datetime.now 
> (),raw_data='s1234')
>>>> sms_detailed.save()
> Traceback (most recent call last):
>  File "", line 1, in 
>  File "/usr/lib/python2.6/site-packages/django/db/models/base.py",  
> line
> 410, in save
>self.save_base(force_insert=force_insert,  
> force_update=force_update)
>  File "/usr/lib/python2.6/site-packages/django/db/models/base.py",  
> line
> 495, in save_base
>result = manager._insert(values, return_id=update_pk)
>  File "/usr/lib/python2.6/site-packages/django/db/models/manager.py",
> line 177, in _insert
>return insert_query(self.model, values, **kwargs)
>  File "/usr/lib/python2.6/site-packages/django/db/models/query.py",
> line 1087, in insert_query
>return query.execute_sql(return_id)
>  File
> "/usr/lib/python2.6/site-packages/django/db/models/sql/subqueries.py",
> line 320, in execute_sql
>cursor = super(InsertQuery, self).execute_sql(None)
>  File "/usr/lib/python2.6/site-packages/django/db/models/sql/ 
> query.py",
> line 2369, in execute_sql
>cursor.execute(sql, params)
>  File "/usr/lib/python2.6/site-packages/django/db/backends/util.py",
> line 19, in execute
>return self.cursor.execute(sql, params)
>  File
> "/usr/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py",
> line 193, in execute
>return Database.Cursor.execute(self, query, params)
> OperationalError: table asms_sms_detailed has no column named  
> phone_num
>
>
> Br, Chen Gang
>
> --
>
> You received this message because you are subscribed to the Google  
> Groups "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com 
> .
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en 
> .
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.