[web2py] mobile responsive table

2018-11-28 Thread lbjc1978
I'd like to have this table to fit in any media screen including ipad and  
mobile phone.
How do I do it. This is the code:
{{extend 'layout.html'}}

.btn{
border-radius: .28rem;
}
h3 { 
display: block;
font-size: 1.17em;
margin-top: 0.5em;
margin-bottom: 1em;
margin-left: 0;
margin-right: 0;
font-weight: light;
font-family: "Josefin Slab";
color:black;
}


We'd love to have data about your state. Please enter or confirm your 
details, then scroll down to submit.


#table {
position: absolute;
top: 12em;
left: 16%;
padding: 1em 3em 3em 3em;
max-width:60em;
max-height:29em;
margin-top: -9em; /*set to a negative number 1/2 of your height*/
margin-left: -15em; /*set to a negative number 1/2 of your width*/
background-color: #DFF0D8;
color:black;
font-family: "Josefin Slab";
border-radius:18px;
overflow:scroll;
}
::-webkit-scrollbar {
width: 0px;  /* remove scrollbar space */
background: transparent; 
}
/* optional: show position indicator in red */
::-webkit-scrollbar-thumb {
background: #FF;
}
table {
width: 100%;
}
tr {
text-align: left;
}


{{=form}}



-- 
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] plugin_jqmobile

2018-11-14 Thread lbjc1978
Following this 
 topic. 
Are we still not using the plugin?
I've tried it but it does not work.
I need to have some pages (see below) to be mobile friendly for an app.


{{extend 'layout.html'}}






http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min
.js">



  
 @import url("http:
//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css")




body
{
font-family: Audiowide;
background-image:url("{{=URL('static','images/18.jpg')}}");
}
html,body
{
height:77%;
}
  .carousel-inner > .item > img, .carousel-inner > .item > a > img
{
  width: 60%;
  margin: auto;
  }
  



  
  


  
  
  







  


  {{=A("ASK!",_href=URL("view_searches"))}}
  Ask your heart out! You can even be anonymous here. So grab 
the opportunity!

  


  


  {{=A("READ!",_href=URL("start"))}}
  Read others' questions and the answers!

  
  


  {{=A("My Questions!",_href=URL("manage"))}}
  Your asked questions!

  





  
  Previous


  
  Next

  




Regards

-- 
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] MongoDB

2018-11-09 Thread lbjc1978
I keep getting this information on my terminal.
WARNING:pyDAL:Attributes 'required', 'cache' and 'cacheable' are 
unsupported by MongoDB
Enter code here...


How can I solve it?
Regards

-- 
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: Mongodb Error

2018-11-01 Thread lbjc1978
turns out to be a password issue.
'db = DAL('mongodb://localhost/connect_test')' 

works well

On Tuesday, 30 October 2018 23:37:23 UTC+3, 黄祥 wrote:
>
> from the error traceback seems like a problem with a connection to 
> mongodb, wrong password or username, pls ensure the authentication to 
> mongodb connection is correct
>
> best regards,
> stifan
>

-- 
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] Mongodb Error

2018-10-30 Thread lbjc1978
I'm trying to use MongoDB for the first time. I looked at this 

 link 
as one of the guidance. but ended up with an error.
My code below:

from gluon import current
from pymongo import MongoClient
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
from gluon.custom_import import track_changes
track_changes(True)
db = DAL('mongodb://username:password@localhost/test', pool_size=0)
Post = db.define_table('post',
   Field('author', 'reference auth_user', default=auth.
user_id, writable=False, readable=False),
   Field('comments', 'text', requires=IS_NOT_EMPTY(),
 default ="Hi there it's me", notnull=False),
   auth.signature
   )




Error:

  File "/home/maurice/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/home/maun/web2py/applications/boyeve/models/db2.py" 
, line 12, in 

db = DAL('mongodb://username:password@localhost/test', pool_size=0)
  File "/usr/local/lib/python2.7/dist-packages/pydal/base.py", line 169, in 
__call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pydal/base.py", line 474, in 
__init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pydal/base.py", line 454, in 
__init__
self._adapter = adapter(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/__init__.py", 
line 40, in __call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/base.py", line 
52, in __init__
self.reconnect()
  File "/usr/local/lib/python2.7/dist-packages/pydal/helpers/classes.py", line 
184, in _reconnect_and_configure
self._configure_on_first_reconnect()
  File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/mongo.py", line 
79, in _configure_on_first_reconnect
"serverStatus")['version']
  File "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line 611, 
in command
read_preference) as (sock_info, slave_ok):
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py", line 
1101, in _socket_for_reads
with self._get_socket(server) as sock_info:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py", line 
1058, in _get_socket
with server.get_socket(self.__all_credentials) as sock_info:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/pymongo/pool.py", line 1006, in 
get_socket
sock_info.check_auth(all_credentials)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/pool.py", line 677, in 
check_auth
auth.authenticate(credentials, self)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 563, in 
authenticate
auth_func(credentials, sock_info)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 540, in 
_authenticate_default
return _authenticate_scram(credentials, sock_info, 'SCRAM-SHA-1')
  File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 262, in 
_authenticate_scram
res = sock_info.command(source, cmd)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/pool.py", line 579, in 
command
unacknowledged=unacknowledged)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/network.py", line 150, 
in command
parse_write_concern_error=parse_write_concern_error)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py", line 155, 
in _check_command_response
raise OperationFailure(msg % errmsg, code, response)
OperationFailure: Authentication failed.


I need help to solve this

Regards

-- 
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] Auth issues when using ldap

2018-10-26 Thread lbjc1978
I am trying out the ldap authentication from an app but encountered this 
error:

 File "/home/mau/web2py/gluon/globals.py", line 421, in 
 self._caller = lambda f: f()
 File "/home/mau/web2py/applications/schoop/controllers/default.py" 
, 
line 43, in user
 if con_parameters[0] != request.vars["host"] or request.vars["username"] != 
'admin':
TypeError: 'Auth' object does not support indexing

Here is the code:

if "host" in request.vars:
session.server=request.vars["host"]
session.username=request.vars["username"]
session.password=request.vars["password"]
con_parameters=auth.settings.login_methods[0]#.__defaults__)


"""session.secureAuth = "off"
if request.vars["secureAuth"]=="on":
session.secureAuth= request.vars["secureAuth"]"""


if con_parameters[0] != request.vars["host"] or request.vars[
"username"] != 'admin':
new_parameters=list(con_parameters)
new_parameters[0]=request.vars["host"]



-- 
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] No module named states

2018-10-26 Thread lbjc1978
I have a module with this: from gluon.contrib.states import *

Getting the above error.

Regards

-- 
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] mobile friendly login page

2018-10-25 Thread lbjc1978
The default login page on the desktop looks absolutely good. The mobile 
page,see attached needs some workup. Is there a way to align the buttons?
Regards

-- 
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] Python loop brings an error

2018-09-08 Thread lbjc1978
AM trying out a now game that involves a continuous input of data with an 
instant  display to the user of an image or data from the db.
How ever, when trying out a small bit of code, before I developed it to 
full scale, I noticed something strange.
This is the code:

results = []
r_lst = []
rlst3 = []
m = []
ffvector = ['vector','vectors','transmit','transmission','port','pots']
ffdef = ['mercedes','bmw','ford','honda','gmc',]
def report():
db = DAL('sqlite://storage.sqlite')#, migrate=False)
db = current.db
auth = Auth(db, hmac_key=Auth.get_or_create_key())
auth.define_tables()
rows = db(db.post.author == auth.user.id).select(db.post.ALL)
for row in rows:
id = row.message
m.append(id)   
rlst = [' '.join(grams)for grams in ngrams(word_tokenize(m[0]),1)]
rlst3.extend(rlst)
for item in rlst3:
if item not in ffvector:
pass
else:
vects = 'We will be getting vectors values here.'
results.append(vects)
if item not in ffdef:
pass
else:
defi = 'first thoughts will be here'
results.append(defi)
return results if results else 'Item not found here again, ', rlst3
controller code

form = FORM(INPUT(_name='message'), INPUT(_type='submit'))
if request.vars:
r.append(request.vars.message)
codes.append(r[0])
db.post.insert(message=codes[0])
return dict(form=form, cars=cars)





This is what I note:

   1. If I post values in the ffvector or ffdef, the reply back to the user 
   is ok.
   2. The moment I type any text not in the above lists, I start getting 
   the same previously replies data. 
   3. When continuously typing text not in the lists, the replies are ok as 
   coded, but typing randomly text in and not in the lists the replies are not 
   as expected.

What could be the error and how do i correct them.
Regards

-- 
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] Access new values in last rowid

2018-08-24 Thread lbjc1978
We are a team of newbies in web2py trying out something new. If we insert 
into a database an item, and let modules access the new values it does not 
work properly as expected.
The code below:
code = ''

form = FORM(INPUT(_name='message'), INPUT(_type='submit'))
if request.vars:
r = [request.vars.message]
db.post.insert(replies=r[0])# successful insert
row = db(db.post.author== auth.user.id).select(db.post.id, db.post.
replies, orderby=~db.post.id, limitby=(0,1)).first()#should get the last row
code  = row.replies if row else None
return dict(value=code)

This code in the modules folder is part of other functions to access the 
latest row value for processing:
def Search_reply():
  db = current.db
  auth = Auth(db, hmac_key=Auth.get_or_create_key())
  auth.define_tables()
  name  = [r.replies.translate(None, '~!@#$%^&*()_+}{|":?><>-=][\';/.,') for 
r in db(db.post.author == auth.user.id).select(db.post.ALL)][-1]
  return name
  ##name will be used by other functions and a reply returned to view 

Problem

   1. Search_reply does not always gets me the last inserted item.
   2. I have to refresh the page for the function Search_reply to retrieve 
   the latest item

Tried options

   1. We tried using a different controller that had Search_replies and 
   called the function in view, also tried using the function from models with 
   the same result.
   2. We tried using db.commit() after db.post.insert() but with the same 
   results. One thing of note is that after the insert to db.post from web2py, 
   if running a python function that accesses the database on the python idle 
   interpreter, the new inserted message from db.post.replies is easily read 
   without having refreshed the web2py view page. Again, '
   code.replies if row else None
   gets the last inserted item BEFORE page refresh.

Is there a way to have modules access the new inserted message within 
web2py without page refresh?
Is there a way of dal refresh (not page refresh) after inserting a new item?
why doesn't db.commit(), on controller work to interrupt the workflow, have 
a message inserted then read the latest item?
We are thinking of something like this in the same workflow:
..workflow starts with user input
..controller functions insert the input to db
..controller imported functions read new inserted message for processing
..modules process message
..module through controller returns reply to view
..workflow ends

cc

Dream team

-- 
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] access id of newly inserted text

2018-08-20 Thread lbjc1978
I am using javascript to insert to database and it works well with 

jQuery('#myform').submit(function() {
ajax('{{=URL('my_search_party')}}',
['message'], 'target');
return false;
});


Controller code:
def my_search_party():
form = SQLFORM(db.post)
if form.accepts(request, formname=None):
pass
elif form.errors:
pass

But when i try to access the recent posted text with this code it does not 
appear, instead its a blank message
row = db(db.post.author== auth.user.id).select(db.post.id, orderby=~db.post.
id, limitby=(0,1)).first()
id = row.id

-- 
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] multiple controllers with one view

2018-08-19 Thread lbjc1978
I have two controllers in an app. 
One controller has functions that manage DAL tables and forms. The second 
has imported module that are sometimes called. They both use one view. I 
have tried to figure out ho to work this out but cant find ho to print 
results to view from the second controller. With this arrangement, I keep 
getting an error message:  

name 'conversations' is not defined


. My second controller has this code:
def conversations():
row = db(db.post.author== auth.user.id).select(db.post.id, db.post.convo
, orderby=~db.post.id, limitby=(0,1)).first()
id = row.convo if row else None
return dict(id=id)


with the view.html
{{=conversations()}}

I tried looking for an example, reference previous items related to this 
and the only answer I got online is this 


-- 
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] how to get request.vars.value to controller

2018-08-15 Thread lbjc1978
Am puzzled by this, that I cant post text from request.vars value to 
database and when refreshing, the text is there but I cant access this 
value to controller functions.
This is my code:
def progress_view():
form = SQLFORM(Post, formstyle='table3cols').process()
if request.vars:
r = [request.vars.name]
codes.append(r[0])
db.post.insert(name=codes[0])
#db(db.post.id > 11).update(message=codes[0])
row = db(db.post.author== auth.user.id).select(db.post.id, 
db.post.name, orderby=~db.post.id, limitby=(0,1)).first()
code = row.name if row else None
return dict(code=code)
Is there a way of accessing the CURRENT value from request.vars to 
controller ? like append to a list without refreshing the page
Is there a javascript/jquery function that can do DAL refresh?

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