unsupported format character 'A' (0x41)

923 views
Skip to first unread message

Hassan Alnatour

unread,
Oct 11, 2012, 6:52:53 AM10/11/12
to web...@googlegroups.com

<type 'exceptions.ValueError'> unsupported format character 'A' (0x41) at index 53

VERSION

web2py™(1, 99, 4, datetime.datetime(2011, 12, 14, 14, 46, 14), 'stable')
PythonPython 2.7.2: C:\Python27\python.exe

TRACEBACK

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
Traceback (most recent call last):
File "C:\web2py\gluon\restricted.py", line 204, in restricted
exec ccode in environment
File "C:/web2py/applications/coacharabia/controllers/default.py", line 228, in <module>
File "C:\web2py\gluon\globals.py", line 172, in <lambda>
self._caller = lambda f: f()
File "C:/web2py/applications/coacharabia/controllers/default.py", line 185, in user
form=auth()
File "C:\web2py\gluon\tools.py", line 1141, in __call__
return getattr(self,args[0])()
File "C:\web2py\gluon\tools.py", line 1766, in login
return cas.login_form()
File "C:\web2py\gluon\contrib\login_methods\extended_login_form.py", line 98, in login_form
form = DIV(self.auth())
File "C:\web2py\gluon\tools.py", line 1141, in __call__
return getattr(self,args[0])()
File "C:\web2py\gluon\tools.py", line 1794, in login
next = replace_id(next, form)
File "C:\web2py\gluon\tools.py", line 79, in replace_id
return url % form.vars
ValueError: unsupported format character 'A' (0x41) at index 53

Hassan Alnatour

unread,
Oct 11, 2012, 7:36:57 AM10/11/12
to web...@googlegroups.com
I dont understand the error anyone can help me with it ?

regards,

Massimo Di Pierro

unread,
Oct 11, 2012, 9:35:48 AM10/11/12
to web...@googlegroups.com
(1, 99, 4, datetime.datetime(2011, 12, 14, 14, 46, 14), 'stable') is one year old. This error and my others have been fixed. You really need to upgrade. ;-)

Hassan Alnatour

unread,
Oct 12, 2012, 2:35:42 PM10/12/12
to web...@googlegroups.com
I know that , i really wont to upgrade web2py , but i told you my problem with the login :(  , and really upset about this , am going crazy


Regards, 

Massimo Di Pierro

unread,
Oct 12, 2012, 3:42:42 PM10/12/12
to web...@googlegroups.com
What is your model? Do you have a custom auth user or a auth extra fields?

Hassan Alnatour

unread,
Oct 12, 2012, 3:50:32 PM10/12/12
to web...@googlegroups.com

# -*- coding: utf-8 -*-

#########################################################################
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and you can use without limitations
#########################################################################

## if SSL/HTTPS is properly configured and you want all HTTP requests to
## be redirected to HTTPS, uncomment the line below:
# request.requires_https()

if not request.env.web2py_runtime_gae:
    
    production=True
    
    URI = 'mysql://hassan:hassan123@localhost/coacharabiadb'
   
    if production:
    
        db=DAL(URI, pool_size=20)
        
    else:
    
        db=DAL('sqlite://storage.sqlite', check_reserved=['mssql'])
else:
    ## connect to Google BigTable (optional 'google:datastore://namespace')
    db = DAL('google:datastore')
    ## store sessions and tickets there
    session.connect(request, response, db = db)
    ## or store session in Memcache, Redis, etc.
    ## from gluon.contrib.memdb import MEMDB
    ## from google.appengine.api.memcache import Client
    ## session.connect(request, response, db = MEMDB(Client()))

## by default give a view/generic.extension to all actions from localhost
## none otherwise. a pattern can be 'controller/function.extension'
response.generic_patterns = ['*'] if request.is_local else []
## (optional) optimize handling of static files
# response.optimize_css = 'concat,minify,inline'
# response.optimize_js = 'concat,minify,inline'

#########################################################################
## Here is sample code if you need for
## - email capabilities
## - authentication (registration, login, logout, ... )
## - authorization (role based authorization)
## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
## - old style crud actions
## (more options discussed in gluon/tools.py)
#########################################################################

from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db, hmac_key=Auth.get_or_create_key())
crud, service, plugins = Crud(db), Service(), PluginManager()

Contryes = ['Jordan']
auth.settings.extra_fields['auth_user']= [
  Field('city',requires=IS_NOT_EMPTY(error_message='الرجاء أدخال أسم المدينة')),
  Field('address','text',requires=IS_NOT_EMPTY(error_message='الرجاء أدخال العنوان لتفعيل خدمة التوصيل')),
  
  Field('country',requires = IS_IN_SET(Contryes,error_message='الرجاء أختيار البلد')),
  Field('phone',requires=IS_NOT_EMPTY(error_message='الرجاء أدخال الهاتف لتفعيل خدمة التوصيل'))]



## create all tables needed by auth if not custom tables
auth.define_tables()

## configure email
mail=auth.settings.mailer
mail.settings.server ='smtp.gmail.com:587'  # your SMTP server
mail.settings.sender = '#'         # your email
mail.settings.login = '#'       # your credentials or None

## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True

## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
## register with janrain.com, write your domain:api_key in private/janrain.key
from gluon.contrib.login_methods.rpx_account import use_janrain
use_janrain(auth,filename='private/janrain.key'
)

from gluon.contrib.login_methods.rpx_account import RPXAccount
from gluon.contrib.login_methods.extended_login_form import ExtendedLoginForm
other_form = RPXAccount(request, api_key='e9e06a5ed01c04decaba7875925a41c834d2e4b7', domain='coacharabia', url=url)
auth.settings.login_form = ExtendedLoginForm(auth,other_form)

# Recaptcha
from gluon.tools import Recaptcha
auth.settings.captcha = Recaptcha(request,
    '6Lf0ltcSAAAAAHn5DJnbG3ROhS4BWF2uRC_3Vfet', '6Lf0ltcSAAAAANiY78w6RXMqOL0jQI4vyjaP9geM')  
auth.settings.login_captcha = False
#########################################################################
## Define your tables below (or better in another model file) for example
##
## >>> db.define_table('mytable',Field('myfield','string'))
##
## Fields can be 'string','text','password','integer','double','boolean'
##       'date','time','datetime','blob','upload', 'reference TABLENAME'
## There is an implicit 'id integer autoincrement' field
## Consult manual for more options, validators, etc.
##
## More API examples for controllers:
##
## >>> db.mytable.insert(myfield='value')
## >>> rows=db(db.mytable.myfield=='value').select(db.mytable.ALL)
## >>> for row in rows: print row.id, row.myfield
#########################################################################

User = ['Men','Women','Both']

Categorys = ['Muscle Building','Gain Wight','Loss Wight','Pre Workout','Post Workout','Beauty Supplements','Vitamins']

Equipments = ['Gym Safty Equipments','Fitness Equipments']

Options = ['Flavor','size']


db.define_table('Brands',
          Field('Brand_Name'),
          Field('owner_Name'),
          Field('Phone'),
          Field('Date_added','date'),
          Field('logo','upload')
          )


db.define_table('Supplements',
          Field('Brand_ID',db.Brands),
          Field('English_Name'),
          Field('Arabic_Name'),
          Field('Arabic_Description','text'),
          Field('English_Description','text'),
          Field('Cover','upload'),
          
          Field('Users',requires=IS_IN_SET(User)),
          Field('Category',requires=IS_IN_SET(Categorys)),
          Field('Old_Pirce','integer'),
          Field('Pirce','integer'),
          Field('Quantity','integer'),
          Field('Date_added','date'),
          Field('Hot','boolean'),
          Field('New','boolean')

)

db.Supplements.Brand_ID.requires = IS_IN_DB(db,db.Brands.id,'%(Brand_Name)s')

db.define_table('Tutorials',
          Field('Supplement_ID', db.Supplements),
          Field('English_Description','text'),
          Field('Arabic_Description','text'),
          Field('Video_URL'),
          Field('Nutrition_Facts','upload')         
)


db.Tutorials.Supplement_ID.requires = IS_IN_DB(db,db.Supplements.id,'%(English_Name)s - %(Brand_ID)s')


db.define_table('Supplements_Statistics',
          Field('Supplement_ID', db.Supplements),
          Field('Views','integer'),
          Field('Purchases','integer')
)


db.define_table('Supplements_Comments',
          Field('Product_ID',db.Supplements),
          Field('Name'),
          Field('Comment'),
          Field('Approved','boolean'),
          Field('DateTime','datetime',default=request.now)

  )

db.define_table('Supplements_Options',
          Field('Supplement_ID',db.Supplements),
          Field('Option_Type',requires=IS_IN_SET(Options)),
          Field('value'),
          Field('Price','integer'),
          Field('order_number','integer')
          


  )
db.Supplements_Options.Supplement_ID.requires = IS_IN_DB(db,db.Supplements.id,'%(English_Name)s - %(Brand_ID)s')

db.Supplements_Comments.Product_ID.requires= IS_IN_DB(db,db.Supplements.id,'%(English_Name)s')

db.define_table('OffersAndArticles',
          Field('English_Title'),
          Field('Arabic_Title'),
          Field('English_Description','text'),
          Field('Arabic_Description','text'),
          Field('Cover_Image','upload'),
          Field('Price'),
          Field('Date','date')
)

db.define_table('Blogpost',
          Field('English_Title'),
          Field('Arabic_Title'),
          Field('English_Post','text'),
          Field('Arabic_Post','text'),
)

db.define_table('Equipment',
          Field('English_Name'),
          Field('Arabic_Name'),
          Field('Cover','upload'),
          Field('Users',requires=IS_IN_SET(User)),
          Field('Category',requires=IS_IN_SET(Equipments)),
          Field('Pirce','integer'),
          Field('Quantity','integer'),
          Field('Date_added','date'),
          Field('Important','boolean')
)

db.define_table('Garage_Sale',
          Field('Name'),
          Field('Year_Made','date'),
          Field('Image','upload'),
          Field('Price','integer'),
          Field('User_ID',db.auth_user)
)




db.define_table('COD',
          Field('Product_ID'),
          Field('Product_Type'),
          Field('User_ID',db.auth_user),
          Field('Country',requires=IS_IN_SET(Contryes)),
          Field('City'),
          Field('Address'),
          Field('Phone')


)


db.define_table('cart',
          Field('OrderID'),
          Field('ProductID',db.Supplements),
          Field('quantity'),
          Field('catid')
          )

db.define_table('orders',
          Field('orderd_items'),
          Field('User_ID'),
          Field('DateTime'),
          Field('Deliverd','boolean'))
          

################################# My Global Functions ###########################################

def youtube(url):
    '''
    Cuting The Youtube URL To Work with the Youtube AIP
    '''
    video_url = url
    urllist=video_url.split("v=")
    videoid = urllist[1].split('&')
    return videoid[0]



# Creating a List For ALL the Item in The Cart
cartlist = []
for i in db(db.cart.OrderID == session.CartID).select(db.cart.ALL):
    if i.ProductID in cartlist:
        isincartlist = "ok"
    else:
        cartlist.append(i.ProductID)



Reply all
Reply to author
Forward
0 new messages