Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
session data or ???
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  17 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
hkmk23@gmail.com  
View profile  
 More options Apr 15 2008, 8:05 am
From: "hkm...@gmail.com" <hkm...@gmail.com>
Date: Tue, 15 Apr 2008 14:05:44 +0200
Local: Tues, Apr 15 2008 8:05 am
Subject: session data or ???
hi all

please , i would like to ask for a little help. I have few functions
stored in my views.py under class Test. When i visit my homepage the
urls.py is calling method homepage from views.py as i mentioned before.
Here it dig some data as current server time and user agent from
webbrowser. Now i need to pass these two details to any other function
when the function is called.  I read all docs about session, cache and
others, but still did not found an answer.
I also tried to store these details to session with

s = SessionStore(session_key='2b2289a188b44ad18c35e113ac6ceead')
s['last_login'] = datetime.datetime.now()
s.save()

and later call it. It saved it but with different session_key.
So back to the first problem. Please how can i pass some data from one
method to all methods.

thank you very much for helping me
pavel


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Horst Gutmann  
View profile  
 More options Apr 15 2008, 8:14 am
From: "Horst Gutmann" <ze...@zerokspot.com>
Date: Tue, 15 Apr 2008 14:14:00 +0200
Subject: Re: session data or ???
Sorry if I misunderstood your problem, why don't you simply store the
last_login somewhere in a userprofile? Since -- judging from the name
-- it should only be altered when the user really logs in, I don't see
the relation with a session there :-/

-- Horst


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
hkmk23@gmail.com  
View profile  
 More options Apr 15 2008, 8:19 am
From: "hkm...@gmail.com" <hkm...@gmail.com>
Date: Tue, 15 Apr 2008 14:19:41 +0200
Local: Tues, Apr 15 2008 8:19 am
Subject: Re: session data or ???
hi Horst

the last_login is an example from documentation. My problems are, that
when i save something to the session(as current date, or user agent)
with some key, and then look to database from terminal, the key is
different.

The second problem is, that i cannot find a way how to pass some data
from one function to all other functions.

thank you
pavel


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
wkn  
View profile  
 More options Apr 15 2008, 8:43 am
From: wkn <AUTOSUGGEST...@gmail.com>
Date: Tue, 15 Apr 2008 05:43:46 -0700 (PDT)
Local: Tues, Apr 15 2008 8:43 am
Subject: Re: session data or ???

I think the current documentation and implementation of the
SessionStore is not correct. I had some problems with it yesterday as
well. I eventually solved it differently and without a session.

However if you just want to access a session from across different
views you can just use the 'request.session' dictionary. No need for
using the SessionStore.

But like Horst said try to figure out if you really need to use a
session in the first place.

Wim

On Apr 15, 2:05 pm, "hkm...@gmail.com" <hkm...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Horst Gutmann  
View profile  
 More options Apr 15 2008, 8:45 am
From: "Horst Gutmann" <ze...@zerokspot.com>
Date: Tue, 15 Apr 2008 14:45:27 +0200
Local: Tues, Apr 15 2008 8:45 am
Subject: Re: session data or ???
Why do you want to manipulate just a specific session that might not
even be an existing sesion anymore? And for what reason do you want to
give other views the same data as the last view that's been used? To
me this sounds just like using a normal session (as provided by
request.session) ...

Could you perhaps tell a few more details about what you want to
achieve and for what reason? :-)

-- Horst


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
hkmk23@gmail.com  
View profile  
 More options Apr 15 2008, 9:09 am
From: "hkm...@gmail.com" <hkm...@gmail.com>
Date: Tue, 15 Apr 2008 15:09:37 +0200
Local: Tues, Apr 15 2008 9:09 am
Subject: Re: session data or ???
ok i will try to explain.

when i or whoever visit homepage, the method from views.py generates
some data, for example
info about operating system or whatever, just some value stored in
variable or dict, let's call it
info = {'system': 'unix'}

later when user is browsing the site, he/she visits some other part of
site when some other method is called. And i need to access this variable.
So does it mean that in every method where i need to work with this
variable i have to save it to sessions in first method and use
request.session in method where i need to work with this variable, or is
there some better way how to pass this variable?
Please feel free to show me some code examples.
thank you
pavel


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Horst Gutmann  
View profile  
 More options Apr 15 2008, 9:17 am
From: "Horst Gutmann" <ze...@zerokspot.com>
Date: Tue, 15 Apr 2008 15:17:57 +0200
Local: Tues, Apr 15 2008 9:17 am
Subject: Re: session data or ???
Well, depending on how you handle this "variable" you have multiple options:

1. Store it into the session using request.session['info'] = info and
retrieve it later from the session when you want to use this data.
2. If you also want to keep this "choice" permanently associated with
the user, I'd store it in the user's profile

IMO these are the only options you have and they are not really bad
ones. Naturally you could also simply pass that choice using GET
parameters, but again: This depends on how you want to use this value.

-- Horst


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
hkmk23@gmail.com  
View profile  
 More options Apr 16 2008, 5:01 am
From: "hkm...@gmail.com" <hkm...@gmail.com>
Date: Wed, 16 Apr 2008 11:01:46 +0200
Local: Wed, Apr 16 2008 5:01 am
Subject: Re: session data or ???
great, thank you very much Horst

now it is working, but still have some question please.

for instance in my views.py i have:

index_globals={}
Class Test:
     init and some more data ....

     def homepage(request):
        some code with variables ....
        index_globals['info'] = user_system
        index_globals['timestamp'] = today
        request.session['index_globals'] = index_globals

so now when i need some data from index_globals in every method i have
to call with

user_start_time = request.session['index_globals']['timestamp']

but what about if i need in my every method the current url path
current_path = request.path

or this index_globals

is there a way i can make this variable global(the current_path will
change every time when some method in views.py will be called), and it
will be automaticaly assign to locals() in every method.
just like

current_path = request.path
  Class Test:

i hope i describe it well, so you will undestand
thank you very much again
pavel


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Horst Gutmann  
View profile  
 More options Apr 17 2008, 6:01 pm
From: "Horst Gutmann" <ze...@zerokspot.com>
Date: Fri, 18 Apr 2008 00:01:57 +0200
Local: Thurs, Apr 17 2008 6:01 pm
Subject: Re: session data or ???
Well, you could minimize the amount of code you will have to repeat
for each and every view function by doing some OOP. For instance you
could probably do something like this in your views.py:

class AbstractView(object):
    def __init__(self, request, *args, **kwargs):
        # Do some generic stuff here
        pass
    def __call__(self, *args, **kwargs):
        raise RuntimeError, "Not implemented"

class TestView(AbstractView):
    def __call__(self, *args, **kwargs):
        return render_to_response('some_template.html',{})

def create_view(klass):
    def _func(request, *args, **kwargs):
        return klass(request, *args, **kwargs)()
    return _func

test = create_view(TestView)

This module provides the view "test".
In this case, you'd put the whole generic stuff you want _all_ your
views to perform into the __init__ method of the AbstractView class.
This is just a quick solution, but it should give you an idea of how
to share processing between views if the short processing requires
request-specific data.

I hope this helps (and isn't a really stupid solution for your problem ;-) )

-- Horst


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "user profile for all methods ?" by hkmk23@gmail.com
hkmk23@gmail.com  
View profile  
 More options Apr 22 2008, 8:25 am
From: "hkm...@gmail.com" <hkm...@gmail.com>
Date: Tue, 22 Apr 2008 14:25:27 +0200
Local: Tues, Apr 22 2008 8:25 am
Subject: user profile for all methods ?
hi all

please i have another question about some data. I have created a model
for user profile in my app. Edited the settings, and it is working ok.

So when user logged in through this method i save this to variable and i
am able to call it from this method. But what if i needed to call this
from all methods in my class. Do i have to save this to session with a
secret key(as for every visitor it should be unique),  and pass the key
in cookies all the time, and from every method parse the cookie, catch
the secret key, and dig data with it from session.

i believe there is some nicer way, isn't it?

thank you very much
pavel


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "how to obtain session key after create" by hkmk23@gmail.com
hkmk23@gmail.com  
View profile  
 More options Apr 22 2008, 9:31 am
From: "hkm...@gmail.com" <hkm...@gmail.com>
Date: Tue, 22 Apr 2008 15:31:13 +0200
Local: Tues, Apr 22 2008 9:31 am
Subject: how to obtain session key after create
hi all

please i am unable to find how to obtain sesssion key after i create the
session.
from
http://www.djangoproject.com/documentation/sessions/#using-sessions-o...

i save some data

from django.contrib.sessions.backends.db import SessionStore

s = SessionStore(session_key='')
s['name'] = 'pavel'
s.save()

so it creates new row in django_session table, but how will i obtain now
the session key to retrive the session data?

thank you very much for advice
pavel


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "0.95.3 version for debian etch" by hkmk23@gmail.com
hkmk23@gmail.com  
View profile  
 More options Aug 15 2008, 5:26 am
From: "hkm...@gmail.com" <hkm...@gmail.com>
Date: Fri, 15 Aug 2008 11:26:59 +0200
Local: Fri, Aug 15 2008 5:26 am
Subject: 0.95.3 version for debian etch
hi all

please i would like know if there is a way how to get latest 0.95.3 to
my debian etch system. as i have official stable src(i am only able to
use stable) and only 0.95.1-1 version is available for me.

thank you very much, pavel


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nick Rehm  
View profile  
 More options Aug 15 2008, 6:48 am
From: Nick Rehm <spe...@nitroforce.de>
Date: Fri, 15 Aug 2008 12:48:27 +0200
Local: Fri, Aug 15 2008 6:48 am
Subject: Re: 0.95.3 version for debian etch
You still can use the latest svn checkout on debian etch.
Like i do. Update cycles on debian can take a long time.

http://www.djangoproject.com/download/

And if you only want to use 0.95.3
http://www.djangoproject.com/download/0.95.3/tarball/
get this tarball

hkm...@gmail.com schrieb:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brett Parker  
View profile  
 More options Aug 15 2008, 6:49 am
From: Brett Parker <iDu...@sommitrealweird.co.uk>
Date: Fri, 15 Aug 2008 11:49:03 +0100
Local: Fri, Aug 15 2008 6:49 am
Subject: Re: 0.95.3 version for debian etch
On 15 Aug 11:26, hkm...@gmail.com wrote:

> hi all

> please i would like know if there is a way how to get latest 0.95.3 to
> my debian etch system. as i have official stable src(i am only able to
> use stable) and only 0.95.1-1 version is available for me.

> thank you very much, pavel

There'll be a new package for the 1.0 beta in the next few days, that'll
most likely go to the experimental distribution - unstable currently has
0.96.2, which could easily be backported to etch. Lenny, currently, also
has the 0.96.2 package, and as lenny is now in freeze is likely to
release with that.

Also, the version that is in debian etch has the patches from 0.95.2 and
0.95.3 merged in to the 0.95.1 package for etch (it being just security
updates, debian policy dictates that we patch and keep the version
number the same).

I'll be creating the 1.0 beta packages this evening, but can (if you
want) create some etch 0.96.2 packages.

Thanks,
--
Brett Parker


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
hkmk23@gmail.com  
View profile  
 More options Aug 15 2008, 7:00 am
From: "hkm...@gmail.com" <hkm...@gmail.com>
Date: Fri, 15 Aug 2008 13:00:28 +0200
Local: Fri, Aug 15 2008 7:00 am
Subject: Re: 0.95.3 version for debian etch
thanks for replay Nick. i know about tar source, but what i need is to
have latest stable version installed via apt-get(without creating own
deb file from tar)  as  the system on all machines is done this way to
keep everything in order. I know the django developers are mostly
updating svn version, but i expected that maintainer for this package
will create update version in which the XSS bug is fixed.

anyway thanks again for answer and have a nice weekend
pavel


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brett Parker  
View profile  
 More options Aug 15 2008, 7:27 am
From: Brett Parker <iDu...@sommitrealweird.co.uk>
Date: Fri, 15 Aug 2008 12:27:26 +0100
Local: Fri, Aug 15 2008 7:27 am
Subject: Re: 0.95.3 version for debian etch
On 15 Aug 13:00, hkm...@gmail.com wrote:

> thanks for replay Nick. i know about tar source, but what i need is to
> have latest stable version installed via apt-get(without creating own
> deb file from tar)  as  the system on all machines is done this way to
> keep everything in order. I know the django developers are mostly
> updating svn version, but i expected that maintainer for this package
> will create update version in which the XSS bug is fixed.

In the debian stable archive you should find python-django-0.95.1-1etch1
(see: http://packages.debian.org/etch/python-django), if you look at the
changelog for that
(http://packages.debian.org/changelogs/pool/main/p/python-django/pytho...)
you'll see that the xss bug is patched in that version.

Thanks,
--
Brett Parker


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
pavel srb  
View profile  
 More options Aug 15 2008, 4:39 pm
From: "pavel srb" <hkm...@gmail.com>
Date: Fri, 15 Aug 2008 22:39:08 +0200
Local: Fri, Aug 15 2008 4:39 pm
Subject: Re: 0.95.3 version for debian etch

great, thank you very much. now it is all clear for me. I had my debian
package from past time. So now i know i should always check for Debian
change log. Reinstalling the package will solve my problem.

thanks again, enjoy weekend
pavel

On Fri, Aug 15, 2008 at 1:27 PM, Brett Parker
<iDu...@sommitrealweird.co.uk>wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google