[12175] | 1 | ## $Id: utils.py 12298 2014-12-22 16:48:23Z henrik $ |
---|
| 2 | ## |
---|
| 3 | ## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann |
---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
| 18 | """Customize general helper utilities for Ikoba. |
---|
| 19 | """ |
---|
| 20 | import pytz |
---|
| 21 | from waeup.ikoba.utils.utils import IkobaUtils, sorted_phone_prefixes |
---|
| 22 | from ikobacustom.skeleton.interfaces import MessageFactory as _ |
---|
| 23 | |
---|
| 24 | INT_PHONE_PREFIXES = [ |
---|
| 25 | (1, _('Nigeria'), '234'), |
---|
| 26 | (99, _('Germany'), '49'), |
---|
| 27 | (99, _('United States'), '1'), |
---|
| 28 | (99, _('Niger'), '227'), |
---|
| 29 | (99, _('Benin'), '229'), |
---|
| 30 | (99, _('Cameroon'), '237'), |
---|
| 31 | (99, _('United Kingdom'), '44'), |
---|
| 32 | (99, _('France'), '33'), |
---|
| 33 | ] |
---|
| 34 | |
---|
| 35 | class SkeletonIkobaUtils(IkobaUtils): |
---|
| 36 | """A collection of methods subject to customization. |
---|
| 37 | """ |
---|
| 38 | PORTAL_LANGUAGE = 'en' |
---|
| 39 | |
---|
| 40 | PREFERRED_LANGUAGES_DICT = { |
---|
| 41 | 'en':(1, u'English'), |
---|
| 42 | 'fr':(2, u'Français'), |
---|
| 43 | 'de':(3, u'Deutsch'), |
---|
| 44 | 'ha':(4, u'Hausa'), |
---|
| 45 | 'yo':(5, u'Yoruba'), |
---|
| 46 | 'ig':(6, u'Igbo'), |
---|
| 47 | } |
---|
| 48 | |
---|
[12298] | 49 | EXPORTER_NAMES = ( |
---|
[12284] | 50 | 'pdfdocuments', |
---|
| 51 | 'htmldocuments', |
---|
| 52 | 'users', |
---|
[12298] | 53 | 'products', |
---|
| 54 | 'customers', |
---|
| 55 | 'skeletoncustomerdocuments', |
---|
| 56 | 'skeletoncontracts') |
---|
[12284] | 57 | |
---|
| 58 | BATCH_PROCESSOR_NAMES = ( |
---|
| 59 | 'skeletoncustomerprocessor', |
---|
| 60 | 'skeletoncustomerdocumentprocessor', |
---|
| 61 | 'skeletoncontractprocessor', |
---|
| 62 | 'skeletonproductprocessor', |
---|
| 63 | 'pdfdocumentprocessor', |
---|
| 64 | 'htmldocumentprocessor', |
---|
| 65 | 'userprocessor') |
---|
| 66 | |
---|
[12175] | 67 | #: A function to return |
---|
| 68 | @classmethod |
---|
| 69 | def sorted_phone_prefixes(cls, data=INT_PHONE_PREFIXES, request=None): |
---|
| 70 | return sorted_phone_prefixes(data, request) |
---|
| 71 | |
---|
| 72 | @property |
---|
| 73 | def tzinfo(self): |
---|
| 74 | return pytz.timezone('Africa/Lagos') |
---|