Ok, this is what i'm trying to do. I don't know if you're familiar with comet chat ( soft of a chat like facebook chat ), and i'm trying to install it along OSQA. I succeeded to install it on a server ( works great ) but, i can only use the chat function after user is logging in. I read their specifications on "how to" do this, but i'm sort of confused ( i'm new to Python ). Bellow is on their support page.

"If you are using another language like ASP, ColdFusion, Python etc. then set a cookie immediately after login with the user's ID. You can read that using the following function :"

function getUserID() {
        $userid = 0; // Return 0 if user is not logged in

if (!empty($_COOKIE['userid'])) {
            $userid = $_COOKIE['userid'];

return $userid;

Ok, i know a little bit more PHP and i understand what this function does... but how can i get the current Session from python ? That's my problem... Also, they've mentioned the fallowing :

"If you are using a more complex method of authentication like storing the session_hash in the database, then your getUserID() function will look something like:"

function getUserID() {
    $userid = 0; // Return 0 if user is not logged in

    if (!empty($_COOKIE['sessionhash'])) {
    $sql = ("select userid from ".TABLE_PREFIX."session 
        where sessionhash = '".mysql_real_escape_string($_COOKIE['sessionhash'])."'");
    $query = mysql_query($sql);
    $session = mysql_fetch_array($query);
    $userid = $session['userid'];

return $userid;


Looked around the web and did read that django uses a DB table for storing sessions ( don't know yet if OSQA is doing the same ).

Anywho, any help is much apreciated... a line of code, a link ... :)


asked 14 Apr '11, 10:26

Teodoru%20Adrian%20Bogdan's gravatar image

Teodoru Adri...
accept rate: 0%

edited 15 Apr '11, 18:29

rickross's gravatar image

rickross ♦♦

you can use some ready django apps with chat functionalities. like: https://github.com/thepug/Speeqe (Stackoverflow's chat.stackoverflow.com) using it. and just easy integrate it with osqa coz it's django-based too. other links: http://code.google.com/p/django-chat/ and http://code.google.com/p/django-jqchat/ I'm myself, using chat from http://ape-project.org with my django project.


answered 14 Apr '11, 10:38

MechanisM's gravatar image

accept rate: 15%

edited 14 Apr '11, 10:43

Thanks for the reply! But, if take a look here : http://www.cometchat.com/demo you can see it's not the same thing ... This chat sort of different ...

(14 Apr '11, 10:42) Teodoru Adri...

hey you can create the same look & functionalities chat from these chats I've provided. even better it's free and opensource. and all django-powered - just like OSQA.

(14 Apr '11, 10:44) MechanisM

I mean by structure/functionality these chats "comet" chats too. If you know what really means comet in web.

(14 Apr '11, 10:46) MechanisM

if you want bottom panel like have chat you provided, you can use: Jixedbar http://code.google.com/p/jixedbar/

(14 Apr '11, 10:50) MechanisM

Yes, i know what comet in web means, I took a look at speeqe, didn't read the requirements yet... i'll give it a try. But, still waiting for a solution if possible :)


(14 Apr '11, 10:54) Teodoru Adri...

btw you can embed your comet chat as iframe, and for autorization use cookies. or store osqa and chat session in redis db for example.


answered 14 Apr '11, 10:53

MechanisM's gravatar image

accept rate: 15%

Yes, Jixedbar provides me a bottom pannel, but it doesn't provide a chat :) as i see it from demo...

(14 Apr '11, 11:00) Teodoru Adri...

jixedbar can be layout basis where you'll run these django powered chats from my links. I mean with jixedbar chats from my links can look like comet chat from your link.

(14 Apr '11, 11:02) MechanisM

MechanisM, your help is much appreciated...but still i want to go with comet chat for a couple of simple reasons ( support, easy instalation ( on server anyways ), great design, etc ). Still anybody can help, would be great !

(14 Apr '11, 15:30) Teodoru Adri...

Doesn't anybody know ? :) ...

(18 Apr '11, 03:36) Teodoru Adri...

then use php-based OSQA analogue: http://support.lampcms.com/ it's will be easy to integrate Comet Chat to it.


answered 18 Apr '11, 14:14

MechanisM's gravatar image

accept rate: 15%

I preferably stick with OSQA under python.. it's greater than any other Q&A system currently on the web. Thanks.

(19 Apr '11, 06:37) Teodoru Adri...

agree. python rocks!

(20 Apr '11, 11:37) MechanisM
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 14 Apr '11, 10:26

Seen: 10,272 times

Last updated: 20 Apr '11, 11:37

powered by OSQA