[web2py] 127.0.0.1 and ip address are not interchangeable, and Port 80 Error

2015-08-06 Thread Zhihong Zeng
Hello,

I just start using web2py, and get the following questions: 

1) Based on my experience on apache, localhost, 127.0.0..1 and local ip 
address obtained by ifconfig in linux are interchangeable. So I can use ip 
address to visit my web page running in a remote computer in the same 
network. 
But when I run web2py, visiting localhost and 127.0.0.1 are successful but 
not local ip address.

2) if I use 80 port on web2py server, I get error: Rocket.Error.Port80

I would appreciate any answers to my questions.

Zhihong

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: cookies related

2013-04-08 Thread dave Zeng
Hi, Anthony,
   Thanks very much,
   It's helpful for the 1st.
   for my 2nd question, setting cookies on browser client could complete 
the task, but need to load another javascript plugin, so i am trying to 
address it in Web2py. 
   Simply speaking, it's a student site, when student practises, the site 
set the current test in cookies(if the student leave and come back later, 
he could start from this test by default, or the student can specify where 
he starts by 'input' field), and get the next test from server, 
continuously.

Thanks
Dave.

On Sunday, April 7, 2013 10:37:25 PM UTC+10, Anthony wrote:

 1. i am using session to transfer user's input from first page to 
 second page via 'redirect', but i don't want to maintain session in 
 filesystem or DB, while seems it's not feasible for web2py, as i tested, 
 there are session files in session directory. so, is it possible to use 
 cookies or session without store the session info?


 If you prefer session data be stored in cookies, from the book:


 


 To *store sessions in cookies* instead you can do:

 session.connect(request,response,cookie_key='yoursecret',compression_level=None)

 Here cookie_key is a symmetric encryption key. compression_level is an 
 optional zlib encryption level.

 While sessions in cookie are often recommended for scalability reason they 
 are limited in size. Large sessions will result in broken cookies.

  

 2. The parameters of the first ajax call in 2nd page come from user's 
 input from the first page, then store and update these parameters to 
 cookies after the ajax call succeeds. continuously, the later ajax calls 
 will use the dynamically-updated parameters which stay in cookies from 
 previous call. So, the problem is: ajax call will use parameters from first 
 page and then use parameters from cookies later. tried to set cookies in 
 the 2nd page with info from 1st page, obviously, it doesn't work.


 It might be more clear if you show some code. Are you setting and 
 retrieving cookie values on the client side via Javascript, or is all that 
 happening on the server (in which case, sessions in cookies as noted above 
 should work)?

 Anthony


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] cookies related

2013-04-07 Thread dave Zeng
Hi, 
   I am new to Web dev, and my question seems not web2py specific, but i am 
using web2py framework, so i am hoping i can get helpful input from the 
community, thanks in advance.
   i have 2-page website, the first page is to collect user's input and 
remember user's input(via cookies to remember now), then pass these info to 
the second page. the second page use the use info from first page, to do 
ajax calls to server, etc.
   My problems:
1. i am using session to transfer user's input from first page to 
second page via 'redirect', but i don't want to maintain session in 
filesystem or DB, while seems it's not feasible for web2py, as i tested, 
there are session files in session directory. so, is it possible to use 
cookies or session without store the session info?
2. The parameters of the first ajax call in 2nd page come from user's 
input from the first page, then store and update these parameters to 
cookies after the ajax call succeeds. continuously, the later ajax calls 
will use the dynamically-updated parameters which stay in cookies from 
previous call. So, the problem is: ajax call will use parameters from first 
page and then use parameters from cookies later. tried to set cookies in 
the 2nd page with info from 1st page, obviously, it doesn't work.
Hope it's clear.
Any advice or resource to look through?

Appreciates 

Thanks
Dave

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: upgrading from 1.95.1 to 1.96.1 breaks cross app authentication

2011-08-03 Thread Heng Zeng Aun
Thanks. Noted

On Tue, Aug 2, 2011 at 3:58 PM, Anthony abasta...@gmail.com wrote:

 On Tuesday, August 2, 2011 2:30:01 AM UTC-4, zeng wrote:

 Ok, and the next question I may sound like a retard, where to submit
 the ticket?


 Looks like this one is solved, but for future reference, tickets get
 submitted here: http://code.google.com/p/web2py/issues/list.

 Anthony




[web2py] Re: upgrading from 1.95.1 to 1.96.1 breaks cross app authentication

2011-08-02 Thread zeng
Hi Massimo,

Further tracing lead to some additional information:

 AppA/models/db.py 
from gluon.shell import exec_environment
common_db = exec_environment('applications/appauth/models/db.py',
request=request, response=response)
db = common_db.db # -- yes, point to the db file in AppAuth
session.connect(request, response, db, masterapp='appauth')
auth = Auth(globals(), db)
auth.define_tables(migrate=False, username=True)
auth.settings.login_url = '/appauth/default/user/login'
---

What's interesting is the exec_enviroment(), which i use to load the
db value from AppAuth in AppA, if exec_environment() is called it will
reset the session to empty, if I do not use exec_enviroment() cross
app login will work in both 1.95.1 and 1.96.1, if I do, it will only
work in 1.95.1

Ok, and the next question I may sound like a retard, where to submit
the ticket?


best,
Zeng


On Aug 1, 11:28 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Please open a ticket about this.

 On Jul 22, 2:25 am, Heng Zeng Aun zeng...@gmail.com wrote:







  Good day Massimo,

  the following are the snippets:

   AppAuth/models/db.py 
  db = DAL('sqlite://storage.sqlite')
  session.connect(request, response, db)
  auth = Auth(globals(), db)
  crud = Crud(globals(), db)
  auth.settings.hmac_key = 'sha512:secret key here'
  auth.define_tables(username=True)
  crud.settings.auth = auth

   AppA/models/db.py 
  db = DAL('sqlite://../../appauth/storage.sqlite') # -- yes, point to the db
  file in AppAuth
  session.connect(request, response, db, masterapp='appauth')
  auth = Auth(globals(), db)
  auth.define_tables(migrate=False, username=True)
  auth.settings.login_url = '/appauth/default/user/login'

   AppA/controllers/default.py 
  @auth.requires_login()
  def index():
      response.view='index.html'
      return dict()

  @auth.requires_permission('sayhello')
  def hello():
      response.view='saysomething.html'
      return dict(message=T(hello))

  The behavior of this in 1.96.1 (and 1.97.1) is that I will be able to login
  and view the page provided in AppAuth, but when browse to AppA or AppB, it
  will not be able to access it because auth says its not loggin. However all
  this works in 1.95.1

  If i go into web2py.gluon.tools.Auth and hack current to current =
  Storage(globals()) like it used to be in 1.95.1, and things works again.

  I'm sure forcing current from threading.local() to something else
  definitely is not the correct way of doing this (as i dont know what is the
  intention of the current is using for as well : ).

  Awaits your input, Many Thanks Massimo.

  best,
  Zeng

  On Thu, Jul 21, 2011 at 8:44 PM, Massimo Di Pierro 

  massimo.dipie...@gmail.com wrote:
   This change should not break it. Can you please show us the code that
   breaks and we will check what is going on? It is possible that one of
   the auth modules has not been patched correctly.

   Massimo

   On Jul 21, 11:02 am, zeng zeng...@gmail.com wrote:
Hey guys,

I'm currently running version 1.95.1 and have 3 application,
AppAuth, AppA, AppB, AppA and AppB is using AppAuth to
authenticate logged in user and it has been working great.

After upgrading 1.96.1 and cross app authentication no longer works,
some debuging lead to:
- web2py.gluon.tools.Auth 
self.environment = current
request = current.request
session = current.session
- web2py.gluon.tools.Auth 

and current is a threading.local() in gluon.globals.py !!!

In the good'o 1.95.1 the session and auth object is retrieved from
global() ,

Question is, why is this changed? this seems to break the backward
compatibility feature of web2py, and what are the recommended
solutions now that global() is no longer used?

Thanks!


[web2py] Re: upgrading from 1.95.1 to 1.96.1 breaks cross app authentication

2011-08-02 Thread zeng
Hi Massimo,

Yes I can confirm it's working now! Many Thanks!

best,
Zeng


On Aug 2, 11:01 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I think I now fixed this in trunk. Can you give it a try?

 Massimo

 On Aug 2, 1:30 am, zeng zeng...@gmail.com wrote:







  Hi Massimo,

  Further tracing lead to some additional information:

   AppA/models/db.py 
  from gluon.shell import exec_environment
  common_db = exec_environment('applications/appauth/models/db.py',
  request=request, response=response)
  db = common_db.db # -- yes, point to the db file in AppAuth
  session.connect(request, response, db, masterapp='appauth')
  auth = Auth(globals(), db)
  auth.define_tables(migrate=False, username=True)
  auth.settings.login_url = '/appauth/default/user/login'
  ---

  What's interesting is the exec_enviroment(), which i use to load the
  db value from AppAuth in AppA, if exec_environment() is called it will
  reset the session to empty, if I do not use exec_enviroment() cross
  app login will work in both 1.95.1 and 1.96.1, if I do, it will only
  work in 1.95.1

  Ok, and the next question I may sound like a retard, where to submit
  the ticket?

  best,
  Zeng

  On Aug 1, 11:28 am, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:

   Please open a ticket about this.

   On Jul 22, 2:25 am, Heng Zeng Aun zeng...@gmail.com wrote:

Good day Massimo,

the following are the snippets:

 AppAuth/models/db.py 
db = DAL('sqlite://storage.sqlite')
session.connect(request, response, db)
auth = Auth(globals(), db)
crud = Crud(globals(), db)
auth.settings.hmac_key = 'sha512:secret key here'
auth.define_tables(username=True)
crud.settings.auth = auth

 AppA/models/db.py 
db = DAL('sqlite://../../appauth/storage.sqlite') # -- yes, point to 
the db
file in AppAuth
session.connect(request, response, db, masterapp='appauth')
auth = Auth(globals(), db)
auth.define_tables(migrate=False, username=True)
auth.settings.login_url = '/appauth/default/user/login'

 AppA/controllers/default.py 
@auth.requires_login()
def index():
    response.view='index.html'
    return dict()

@auth.requires_permission('sayhello')
def hello():
    response.view='saysomething.html'
    return dict(message=T(hello))

The behavior of this in 1.96.1 (and 1.97.1) is that I will be able to 
login
and view the page provided in AppAuth, but when browse to AppA or AppB, 
it
will not be able to access it because auth says its not loggin. However 
all
this works in 1.95.1

If i go into web2py.gluon.tools.Auth and hack current to current =
Storage(globals()) like it used to be in 1.95.1, and things works 
again.

I'm sure forcing current from threading.local() to something else
definitely is not the correct way of doing this (as i dont know what is 
the
intention of the current is using for as well : ).

Awaits your input, Many Thanks Massimo.

best,
Zeng

On Thu, Jul 21, 2011 at 8:44 PM, Massimo Di Pierro 

massimo.dipie...@gmail.com wrote:
 This change should not break it. Can you please show us the code that
 breaks and we will check what is going on? It is possible that one of
 the auth modules has not been patched correctly.

 Massimo

 On Jul 21, 11:02 am, zeng zeng...@gmail.com wrote:
  Hey guys,

  I'm currently running version 1.95.1 and have 3 application,
  AppAuth, AppA, AppB, AppA and AppB is using AppAuth to
  authenticate logged in user and it has been working great.

  After upgrading 1.96.1 and cross app authentication no longer works,
  some debuging lead to:
  - web2py.gluon.tools.Auth 
  self.environment = current
  request = current.request
  session = current.session
  - web2py.gluon.tools.Auth 

  and current is a threading.local() in gluon.globals.py !!!

  In the good'o 1.95.1 the session and auth object is retrieved from
  global() ,

  Question is, why is this changed? this seems to break the backward
  compatibility feature of web2py, and what are the recommended
  solutions now that global() is no longer used?

  Thanks!


[web2py] Re: upgrading from 1.95.1 to 1.96.1 breaks cross app authentication

2011-08-01 Thread zeng
Hi Guys, Some info update, I've just tried with the latest release
1.98.1 and the problem still persists.

best,
Zeng

On Jul 22, 10:25 am, Heng Zeng Aun zeng...@gmail.com wrote:
 Good day Massimo,

 the following are the snippets:

  AppAuth/models/db.py 
 db = DAL('sqlite://storage.sqlite')
 session.connect(request, response, db)
 auth = Auth(globals(), db)
 crud = Crud(globals(), db)
 auth.settings.hmac_key = 'sha512:secret key here'
 auth.define_tables(username=True)
 crud.settings.auth = auth

  AppA/models/db.py 
 db = DAL('sqlite://../../appauth/storage.sqlite') # -- yes, point to the db
 file in AppAuth
 session.connect(request, response, db, masterapp='appauth')
 auth = Auth(globals(), db)
 auth.define_tables(migrate=False, username=True)
 auth.settings.login_url = '/appauth/default/user/login'

  AppA/controllers/default.py 
 @auth.requires_login()
 def index():
     response.view='index.html'
     return dict()

 @auth.requires_permission('sayhello')
 def hello():
     response.view='saysomething.html'
     return dict(message=T(hello))

 The behavior of this in 1.96.1 (and 1.97.1) is that I will be able to login
 and view the page provided in AppAuth, but when browse to AppA or AppB, it
 will not be able to access it because auth says its not loggin. However all
 this works in 1.95.1

 If i go into web2py.gluon.tools.Auth and hack current to current =
 Storage(globals()) like it used to be in 1.95.1, and things works again.

 I'm sure forcing current from threading.local() to something else
 definitely is not the correct way of doing this (as i dont know what is the
 intention of the current is using for as well : ).

 Awaits your input, Many Thanks Massimo.

 best,
 Zeng

 On Thu, Jul 21, 2011 at 8:44 PM, Massimo Di Pierro 







 massimo.dipie...@gmail.com wrote:
  This change should not break it. Can you please show us the code that
  breaks and we will check what is going on? It is possible that one of
  the auth modules has not been patched correctly.

  Massimo

  On Jul 21, 11:02 am, zeng zeng...@gmail.com wrote:
   Hey guys,

   I'm currently running version 1.95.1 and have 3 application,
   AppAuth, AppA, AppB, AppA and AppB is using AppAuth to
   authenticate logged in user and it has been working great.

   After upgrading 1.96.1 and cross app authentication no longer works,
   some debuging lead to:
   - web2py.gluon.tools.Auth 
   self.environment = current
   request = current.request
   session = current.session
   - web2py.gluon.tools.Auth 

   and current is a threading.local() in gluon.globals.py !!!

   In the good'o 1.95.1 the session and auth object is retrieved from
   global() ,

   Question is, why is this changed? this seems to break the backward
   compatibility feature of web2py, and what are the recommended
   solutions now that global() is no longer used?

   Thanks!


Re: [web2py] Re: upgrading from 1.95.1 to 1.96.1 breaks cross app authentication

2011-07-22 Thread Heng Zeng Aun
Good day Massimo,

the following are the snippets:

 AppAuth/models/db.py 
db = DAL('sqlite://storage.sqlite')
session.connect(request, response, db)
auth = Auth(globals(), db)
crud = Crud(globals(), db)
auth.settings.hmac_key = 'sha512:secret key here'
auth.define_tables(username=True)
crud.settings.auth = auth

 AppA/models/db.py 
db = DAL('sqlite://../../appauth/storage.sqlite') # -- yes, point to the db
file in AppAuth
session.connect(request, response, db, masterapp='appauth')
auth = Auth(globals(), db)
auth.define_tables(migrate=False, username=True)
auth.settings.login_url = '/appauth/default/user/login'

 AppA/controllers/default.py 
@auth.requires_login()
def index():
response.view='index.html'
return dict()

@auth.requires_permission('sayhello')
def hello():
response.view='saysomething.html'
return dict(message=T(hello))


The behavior of this in 1.96.1 (and 1.97.1) is that I will be able to login
and view the page provided in AppAuth, but when browse to AppA or AppB, it
will not be able to access it because auth says its not loggin. However all
this works in 1.95.1

If i go into web2py.gluon.tools.Auth and hack current to current =
Storage(globals()) like it used to be in 1.95.1, and things works again.

I'm sure forcing current from threading.local() to something else
definitely is not the correct way of doing this (as i dont know what is the
intention of the current is using for as well : ).

Awaits your input, Many Thanks Massimo.

best,
Zeng

On Thu, Jul 21, 2011 at 8:44 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 This change should not break it. Can you please show us the code that
 breaks and we will check what is going on? It is possible that one of
 the auth modules has not been patched correctly.

 Massimo

 On Jul 21, 11:02 am, zeng zeng...@gmail.com wrote:
  Hey guys,
 
  I'm currently running version 1.95.1 and have 3 application,
  AppAuth, AppA, AppB, AppA and AppB is using AppAuth to
  authenticate logged in user and it has been working great.
 
  After upgrading 1.96.1 and cross app authentication no longer works,
  some debuging lead to:
  - web2py.gluon.tools.Auth 
  self.environment = current
  request = current.request
  session = current.session
  - web2py.gluon.tools.Auth 
 
  and current is a threading.local() in gluon.globals.py !!!
 
  In the good'o 1.95.1 the session and auth object is retrieved from
  global() ,
 
  Question is, why is this changed? this seems to break the backward
  compatibility feature of web2py, and what are the recommended
  solutions now that global() is no longer used?
 
  Thanks!



[web2py] upgrading from 1.95.1 to 1.96.1 breaks cross app authentication

2011-07-21 Thread zeng
Hey guys,

I'm currently running version 1.95.1 and have 3 application,
AppAuth, AppA, AppB, AppA and AppB is using AppAuth to
authenticate logged in user and it has been working great.

After upgrading 1.96.1 and cross app authentication no longer works,
some debuging lead to:
- web2py.gluon.tools.Auth 
self.environment = current
request = current.request
session = current.session
- web2py.gluon.tools.Auth 

and current is a threading.local() in gluon.globals.py !!!

In the good'o 1.95.1 the session and auth object is retrieved from
global() ,

Question is, why is this changed? this seems to break the backward
compatibility feature of web2py, and what are the recommended
solutions now that global() is no longer used?

Thanks!



[web2py] Re: Plugin_jqgrid problem

2010-05-28 Thread zeng leo
 Hi,everyone, i'm a newbie for web2py,I'm in trouble  when I use the
 plugin_jqgrid. this is  my code:

 my dbmodel:

 db.define_table(data,
  SQLField(name, notnull=True, default=None),
  SQLField(date,notnull=True),
  SQLField(number, notnull=True, default=None),
  SQLField(later_times, integer, default=None),
  SQLField(leave_early_times, integer, default=None),
  SQLField(absenteeism_times, integer,  default=None),
  SQLField(later_time,default=None),
  SQLField(leave_early_time, default=None),
  SQLField(work_time, default=None),
  SQLField(department,default=None),
  SQLField(description,default=None))


 my controller:

  def index():



 grid=plugin_jqgrid(db.data,columns=['id','name','date','number','later_times','leave_early_times','absenteeism_times','later_time','leave_early_time','work_time','department','description'],,col_width=75,height=600)
return dict(grid=grid)



 my view:
 default/index.html

 {{extend 'layout.html'}}

 h2 1.all data /h2
 {{ =grid}}

 h22.all data /h2
 {{ =grid}}


 I found just one grid display in my page when i run the code.
 where is the problem?