[web2py] Even after setting routes.py to my app name GideonGeorge, my site doesn't go as expected

2015-11-05 Thread Gideon George
What could be the problem? my site goes 
to http://www.gideongeorge.com/welcome/default/index when it should just go 
to the domain root.
Please somebody help me out.

Thanks

-- 
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 use crud.select(db, query) to extract values in db table

2014-12-04 Thread Gideon George
This is my db
db = DAL('sqlite://storage.sqlite')
db.define_table('entry',
Field('name'),
Field('location'),
Field('state_of_origin'),
Field('local_govt'),
Field('file', 'upload'),
Field('posted_on','datetime',readable=False,writable=False)
)


I want to extract only the values from my db table called entry using 
crud. I understand i have to do this
 name = crud.select(db.entry, query)

But because i don't know the fomular for extracting the query, I did this
name = crud.select(db.entry, fields=['name'])
I got the fields with the values as result.

I just want the values only! Please help me with the formular for getting 
each of the values in my table using query.

Action Controller

def zone():
db.entry.posted_on.default = request.now
form=crud.create(db.entry,  next=URL('zone'), message=T('Record 
created'))
name = crud.select(db.entry, fields=['name'])
location  = crud.select(db.entry, fields=['location'])
state = crud.select(db.entry, fields=['state_of_origin'])
lga = crud.select(db.entry, fields=['local_govt'])
image = crud.select(db.entry, fields=['file'])

View

 I rep {{=lga}}, {{=state}} State. By {{=name}}br/
lives in {{=location}} on {{=how can I show the time here?}}

ABOVE IS EXACTLY HOW I WANT IT TO APPEAR.

-- 
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] Like the 1st example in the web2py book, can I customize my session.counter to count all sessions?

2014-12-01 Thread Gideon George


Please what I can do if I want to display the number of visits to each page of 
my site without restricting it to just individual sessions? 

Unlike the code below where it displays number of visits for a particular 
session, I want a situation where by I can put something like this at my 
footer. Since December 1, this page has been viewed 12499 times. Please help 
me with the code if you can, I tried everything possible to no avail.

def index():
if not session.counter:
session.counter = 1
else:
session.counter += 1
return dict(message=Hello from MyApp, counter=session.counter)

-- 
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 can I create a virtualenv and follow this instruction in web2py?

2014-09-17 Thread Gideon George
Please somebody help me on how to go about following this instruction below.
On a mission to create something http://feeds.uni.me/ (RSS Feed reader)
I don't know exactly where to start.
where can I find the web2py commandline to help create the virtualenv? Or 
is it not all going to be done within a commandline? Please help me clear 
my confusion and start.
Thank you



-
This is not an plug-n-play web2py application there are some work to be 
done.
Follow some install instructions - I hope completed:

create a virtualenv and install:

  pip install feedparser
  pip install bs4
  pip install beautifulsoup4
  pip install FilterHTML
  pip install times
  pip install guess-language
  pip install whoosh
  pip install lxml
  pip install bottle


run the initial setup:

  $ python web2py.py -MS feeds -R applications/feeds/scripts/setup.py


it will create a user a...@a.aa with pass 1234, and fetch one reddit feed.


to periodically fetch feeds, run:

  $ python web2py.py -MS feeds -R applications/feeds/modules/feeds_update.py

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


Re: [web2py] Can I create an RSS Reader like Techi in web2py?

2014-08-20 Thread Gideon George
OMG! You need to see the reaction I made as soon as I saw the mail from
you! I am so excited and full of happiness.
I really appreciate a great deal and I pray God will continue to grant you
all your heart desires and make all your dreams turn to reality.

As a newbie web2py user that has never used a framework before, all the
terms here are very new to me, but I will go through them one after the
other to make everything work perfectly. I am so excited that about what I
will learn.
The site I am developing is www.gidigba.ng I want to have a page to extract
all potilical news from Nigeria as rss or something.
Thank you once more again I am very grateful.



On Mon, Aug 18, 2014 at 11:22 PM, Ricardo Pedroso rmdpedr...@gmail.com
wrote:

 On 8/14/14, Gideon George georgegid...@gmail.com wrote:
  Oh Ok, that will be great! I can't wait... Wish you the best of the best.

 Follows attached...


 This is not an plug-n-play web2py application there are some work to be
 done.
 Follow some install instructions - I hope completed:

 create a virtualenv and install:

   pip install feedparser
   pip install bs4
   pip install beautifulsoup4
   pip install FilterHTML
   pip install times
   pip install guess-language
   pip install whoosh
   pip install lxml
   pip install bottle


 run the initial setup:

   $ python web2py.py -MS feeds -R applications/feeds/scripts/setup.py


 it will create a user a...@a.aa with pass 1234, and fetch one reddit feed.


 to periodically fetch feeds, run:

   $ python web2py.py -MS feeds -R
 applications/feeds/modules/feeds_update.py


 Note:
 I recommend to have redis installed and running to have cache
 and sessions store in it, otherwise file sessions and file cache
 will be used.


 I think that's all.

 --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/3RzivktPaRI/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


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


Re: [web2py] Can I create an RSS Reader like Techi in web2py?

2014-08-14 Thread Gideon George
Oh Ok, that will be great! I can't wait... Wish you the best of the best.
Thank you


On Wed, Aug 13, 2014 at 11:28 PM, Ricardo Pedroso rmdpedr...@gmail.com
wrote:

 Next weekend I can share the code. I have to cleanning it a little bit.

 Ricardo


 On 8/11/14, Gideon George georgegid...@gmail.com wrote:
 
 
  WOW! That's really great to hear. I don't even know how to start
  appreciating right now.
 
  I am really grateful for that, Absolutely grateful! I will love to learn
  and implement it. it's gonna help me alot.
  Thank you very much and I pray that God grant you all your heart desires,
  Amen.
 
  It's my very first web2py app and I am really learning and excited. I
 want
  to be one of the best in Africa, and I am on my way...I just can't wait
 to
  start!
 
  --
  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.
 

 --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/3RzivktPaRI/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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: Web2py Form Error! PLEASE HELP!!!! = long() argument must be a string or a number, not 'Table'

2014-08-11 Thread Gideon George
This is my action in default.py (Everything is working fine, except the 
form in the view, if I write and submit the post, it gives this error above)
@auth.requires_login()
def timeline():
db.post.posted_by.default =  auth.user_id
db.post.posted_on.default = request.now
#create form with which the user can submit posts
crud.settings.formstyle = 'table2cols'
form = crud.create(db.post)
#determine who the user follows
my_followees = db(db.followers.follower==me)
me_and_my_followees = [me]+[row.followee for row in 
my_followees.select(db.followers.followee)]
#Pull all posts to be displayed
postings = 
db(db.post.posted_by.belongs(me_and_my_followees)).select(orderby=~db.post.posted_on,limitby=(0,100))
return locals()


In db.py model

db.define_table('post',
Field('body', 'text', requires=IS_LENGTH(280, 1), 
label=What's going down? ),
Field('posted_by', 'reference auth_user'),
Field('posted_on', 'datetime', 
requires=IS_DATETIME('%d-%m-%Y%H:%M:%S'))
)
db.post.body.required = True
db.post.body.requires = IS_LENGTH(280, 1)

db.post.posted_on.required = True
db.post.posted_by.required = True
db.post.posted_on.default = request.now

db.post.posted_on.writable = db.post.posted_on.readable = False
db.post.posted_by.writable = db.post.posted_by.readable = False

My view below
{{extend 'layout.html'}}
 a class=btn polsearch   href={{=URL(c=default, f=search)}} i 
class=icon-search icon-white spaceit/iSearch for politicians, people 
to follow.../a
{{=A(T(Start a petition), _href=URL('admin','default','index'), 
_class='btn petition pull-right',
 _style='margin-top: 1em;')}}
hr
{{=form}}
script$('textarea').css('width','600px').css('height', '50px');/script
{{for post in postings:}}
div style=background:#F0; margin-bottom:5px; padding:8px; 
width:600px;
h4{{=name_of(post.posted_by)}} on {{=post.posted_on}}/h4
{{=MARKMIN(post.body)}}
/div
{{pass}}

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


Re: [web2py] Can I create an RSS Reader like Techi in web2py?

2014-08-10 Thread Gideon George


 WOW! That's really great to hear. I don't even know how to start 
 appreciating right now.

I am really grateful for that, Absolutely grateful! I will love to learn 
and implement it. it's gonna help me alot.
Thank you very much and I pray that God grant you all your heart desires, 
Amen.

It's my very first web2py app and I am really learning and excited. I want 
to be one of the best in Africa, and I am on my way...I just can't wait to 
start! 

-- 
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] Please help me clear this error! long() argument must be a string or a number, not 'Table'

2014-08-10 Thread Gideon George
I have to copy the error ticket and paste it here, please help me. It's 
been killing me for days! I can't write a post and post it to the database 
of the form crud.create(db.table)
All the tutorials I follow used it perfectly but I have never used it 
successfully. What is happening?


type 'exceptions.TypeError' long() argument must be a string or a number, 
not 'Table'Versionweb2py™Version 2.9.5-stable+timestamp.2014.03.16.02.35.39
PythonPython 2.7.5+: /usr/local/bin/uwsgi (prefix: /usr)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.

Traceback (most recent call last):
  File /home/GideonG/web2py/Gidigba/gluon/restricted.py, line 220, in 
restricted
exec ccode in environment
  File 
/home/GideonG/web2py/Gidigba/applications/Gidigba/controllers/default.py 
https://www.gidigba.ng/admin/edit/Gidigba/controllers/default.py, line 230, 
in module
  File /home/GideonG/web2py/Gidigba/gluon/globals.py, line 385, in lambda
self._caller = lambda f: f()
  File 
/home/GideonG/web2py/Gidigba/applications/Gidigba/controllers/default.py 
https://www.gidigba.ng/admin/edit/Gidigba/controllers/default.py, line 194, 
in timeline
if form.accepts(request):
  File /home/GideonG/web2py/Gidigba/gluon/sqlhtml.py, line 1592, in accepts
self.vars.id = self.table.insert(**fields)
  File /home/GideonG/web2py/Gidigba/gluon/dal.py, line 9114, in insert
ret =  self._db._adapter.insert(self, self._listify(fields))
  File /home/GideonG/web2py/Gidigba/gluon/dal.py, line 1353, in insert
query = self._insert(table,fields)
  File /home/GideonG/web2py/Gidigba/gluon/dal.py, line 1344, in _insert
values = ','.join(self.expand(v, f.type) for f, v in fields)
  File /home/GideonG/web2py/Gidigba/gluon/dal.py, line 1344, in genexpr
values = ','.join(self.expand(v, f.type) for f, v in fields)
  File /home/GideonG/web2py/Gidigba/gluon/dal.py, line 1552, in expand
return str(self.represent(expression,field_type))
  File /home/GideonG/web2py/Gidigba/gluon/dal.py, line 2014, in represent
return str(long(obj))
TypeError: long() argument must be a string or a number, not 'Table'

Error snapshot [image: help] 
https://www.gidigba.ng/admin/default/ticket/Gidigba/41.203.69.5.2014-08-11.00-24-47.07c4862d-35e4-41e3-842c-4bd7c01f5921#

type 'exceptions.TypeError'(long() argument must be a string or a number, 
not 'Table')

inspect attributes
Frames
   
   - 
   
   *File /home/GideonG/web2py/Gidigba/gluon/restricted.py in restricted at 
   line 220* code arguments variables
   - 
   
   *File 
   /home/GideonG/web2py/Gidigba/applications/Gidigba/controllers/default.py in 
   module at line 230* code arguments variables
   - 
   
   *File /home/GideonG/web2py/Gidigba/gluon/globals.py in lambda at line 
   385* code arguments variables
   - 
   
   *File 
   /home/GideonG/web2py/Gidigba/applications/Gidigba/controllers/default.py in 
   timeline at line 194* code arguments variables
   - 
   
   *File /home/GideonG/web2py/Gidigba/gluon/sqlhtml.py in accepts at line 
   1592* code arguments variables
   - 
   
   *File /home/GideonG/web2py/Gidigba/gluon/dal.py in insert at line 9114* 
   code arguments variables
   - 
   
   *File /home/GideonG/web2py/Gidigba/gluon/dal.py in insert at line 1353* 
   code arguments variables
   - 
   
   *File /home/GideonG/web2py/Gidigba/gluon/dal.py in _insert at line 1344* 
   code arguments variables
   - 
   
   *File /home/GideonG/web2py/Gidigba/gluon/dal.py in genexpr at line 
   1344* code arguments variables
   - 
   
   *File /home/GideonG/web2py/Gidigba/gluon/dal.py in expand at line 1552* 
   code arguments variables
   - 
   
   *File /home/GideonG/web2py/Gidigba/gluon/dal.py in represent at line 
   2014* code arguments variables
   Function argument list
   
   (self=gluon.dal.MySQLAdapter object, obj=Table auth_user 
   
(id,first_name,last_name,email,..._government,city_of_resident,image,phone_number),
 
   fieldtype='reference auth_user')
   Code listing
   
   2009.
   2010.
   2011.
   2012.
   2013.
   2014.
   
   2015.
   2016.
   2017.
   2018.
   
   return str(obj)
   elif field_is_type('reference'): # reference
   # check for tablename first
   referenced = fieldtype[9:].strip()
   if referenced in self.db.tables:
   return str(long(obj))
   
   p = referenced.partition('.')
   if p[2] != '':
   try:
   ftype = self.db[p[0]][p[2]].type
   
   


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

Re: [web2py] Can I create an RSS Reader like Techi in web2py?

2014-08-08 Thread Gideon George


 Thank you everyone for your contributions.

 
 Ricardo please I am still trying to figure out how to to this, and looking 
at the url you gave on www.feeds.uni.me redirrects to http://vioos.com/.

I really like the layout of http://vioos.com/ .Please was that done using 
rss in web2py? if yes how possibly can I have something similar that will 
extract all political news about Nigeria like that. 

I really desire to see me getting this done perfectly, I will be very 
happy! Thank you

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


Re: [web2py] Can I create an RSS Reader like Techi in web2py?

2014-08-08 Thread Gideon George
That's really great! I just saw it. initially it was redirecting me to vioos
I really like your layout and everything about it.

Please I need your help to be able to do something similar to extract
political news concerning Nigeria
Any tutorial or something? It's my first web2py app I need you to help me
on this.
Thank you


On Fri, Aug 8, 2014 at 4:41 PM, Ricardo Pedroso rmdpedr...@gmail.com
wrote:

 On 8/8/14, Gideon George georgegid...@gmail.com wrote:
 
 
  Thank you everyone for your contributions.
 
 
   Ricardo please I am still trying to figure out how to to this, and
 looking
 
  at the url you gave on www.feeds.uni.me redirrects to http://vioos.com/.

 it's feeds.uni.me without www.
 I don't know nothing about vioos.

 Ricardo

 --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/3RzivktPaRI/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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] form = crud.create(db.post)

2014-08-08 Thread Gideon George

I have a table named post in my db model and 
because of this line in my action controller form = crud.create(db.post) 
I keep on getting this error below.

type 'exceptions.TypeError' long() argument must be a string or a number, 
not 'Table'


Please help me and tell me what to do.

Thank you

-- 
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] DAL using Mysql.server on pythonanywhere is not working. Giving errors

2014-08-05 Thread Gideon George
Please I need somebody to help me make my site visible by telling me what 
to do to make my database connection work on the pythonanywhere.com remote 
server
I have tried all I could but never seems to get close.

This is how I did it from the pythonanywhere database dashboard and below 
to is my DAL connection in db.py
MySQL Database host address:mysql.serverDatabase username:my_username
Database   my_username$ 
https://www.pythonanywhere.com/user/GideonG/databases/database_console/mysql/GideonG$homeler/
dbname 


db = DAL('mysql://my_username$:my_password@mysql.server/my_username$dbname')





Please somebody should help me out. I need this site to be online 
www.homeler.com.ng without errors

-- 
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] Can I create an RSS Reader like Techi in web2py?

2014-07-04 Thread Gideon George
I want to create an awesome rss feed agregator like that of techi.com
please is there any example of site that did it in web2py? Also I need 
suggestions on how to go about it.
Thank you

-- 
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: Importing an already existing MySQL database

2014-07-03 Thread Gideon George
Please how can I use the script? I mean, where will I save the script? 
anywhere online where I can just download it instead of copy  paste?

On Wednesday, 15 July 2009 00:09:20 UTC+1, Boriel wrote:

 Hi,

 I'm rather new to web2py, but I think this script might be helpful to 
 others.
 I've created a little python script that will automatically dump on
 the screen the creation of an already existing mysql database to be
 ready to use with web2py.

 So, for example, if you have already created a MySQL db called
 mybooks and want to import it to web2py, just type:
 mysqltoweb2py.py mybooks user passwd

 And it will dump on the screen the orders needed to be copied in the db.py 
 file.
 This is the script:

 = 8 == 8 == 8 ==
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 '''
 mysqltoweb2py -- Import an already existing MySQL Database
 into web2py.

 Usage:
 mysqltoweb2py.py database userid passwd
 '''

 import sys
 import re
 import MySQLdb

 reFieldType = re.compile(r'([a-zA-Z]+)([(]\d+[)])?')
 reLetter = re.compile('[a-zA-Z]')


 datab = sys.argv[1]
 user = sys.argv[2]
 passwd = sys.argv[3]

 db=MySQLdb.connect(host='localhost',user=user, passwd = passwd, db = datab)


 def error_msg(msg):
 ''' This could be implemented as an exception
 '''
 sys.stderr.write(%s\n % msg)
 sys.exit(1)


 def output_table(table):
 cursor=db.cursor()
 cursor.execute('show columns from `%s`' % table)

 print db.define_table('%s', % table
 # Extract table fields
 for field in cursor.fetchall():
 if field[0] == 'id':
 continue # id field ignored

 if not reLetter.match(field[0][0]):
 error_msg(Error: field name [%s] in table [%s] does not
 begin with a letter % (field[0], table))

 ftype = reFieldType.match(field[1])
 if not ftype:
 error_msg(Error: could not parse column type)

 _type, _len = tuple(ftype.groups())
 if _type == 'varchar':
 _type = 'string'
 elif _type in ('int', 'tinyint'):
 _type = 'integer'

 print \tSQLField('%s', % field[0],
 print type = '%s' % _type,
 if _len is not None: # Has a length?
 print , length = %i % int(_len[1:-1]),
 print ),

 print \tmigrate = False)


 cursor = db.cursor()
 cursor.execute('show tables')
 for table in cursor.fetchall():
 print
 output_table(table[0])
 === 8 == 8 == 8 ==

 Many things to be done:

 1) Fieldnames starting with _ are not allowed by web2py (but MySQL
 allows it). An error is printed
 2) Some field types do not exist in web2py (e.g. tinyint) so an
 equivalent is used.

 Regards,
 J.

 -- 
 Boriel  http://www.boriel.com



-- 
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 can I import an existing database to my db.py model?

2014-07-03 Thread Gideon George

I have successfully changed the default sqlite connection to mysql. Now I 
want to import an exported file (database.sql) which is an existing 
database. I need help on how I can do this please

-- 
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] Web2py Views: Multiple images changing in the background of index?

2014-06-24 Thread Gideon George
Please I need a help, this is the first time I am posting here and I am in 
my journey to be the Africa's number one Web2py enthusiast. I am currently 
developing my first web2py application and I have less than a week to 
complete it and head over to a more complex application by next week.

My question to the community is, I want to use two pictures rotating 
display as my background image in the index. please help me with suggestion 
on how to go about it.
Thank you.
NB: Example of a similar situation is the index of twitter(i.e before user 
logged in)

-- 
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] Background images slides like twitter?

2014-06-24 Thread Gideon George
Please I need somebody to help me on suggestions on how to put 
background-images in my website's index. just like twitter. Thank you

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