Ñò
$¤5Mc           @   s‡   d  d k  Z  d e  i d <d  d k l Z d  d k l Z d  d k l Z d e f d „  ƒ  YZ d	 „  Z	 d
 „  Z
 d „  Z d „  Z d S(   iÿÿÿÿNs   pootle.settingst   DJANGO_SETTINGS_MODULE(   t   transaction(   t   NoArgsCommand(   t   Usert   Commandc           B   s   e  Z d  „  Z RS(   c         K   s   t  ƒ  d  S(   N(   t   create_default_db(   t   selft   options(    (    sC   /var/www/Pootle/local_apps/pootle_app/management/commands/initdb.pyt   handle_noargs   s    (   t   __name__t
   __module__R   (    (    (    sC   /var/www/Pootle/local_apps/pootle_app/management/commands/initdb.pyR      s   c           C   s¤   zf y0 t  i ƒ  t  i t ƒ t ƒ  t ƒ  t ƒ  Wn/ t  i ƒ  o t  i ƒ  n t  i	 ƒ  ‚  n XWd t  i
 ƒ  o) t  i ƒ  o t  i ƒ  n t  i	 ƒ  n Xd S(   s×   This creates the default database to get a working Pootle installation.

    You can tweak the methods called or their implementation elsewhere in the
    file. This provides some sane default to get things working.N(   R   t   enter_transaction_managementt   managedt   Truet   create_default_projectst   create_default_languagest   create_default_admint   is_dirtyt   rollbackt   leave_transaction_managementt
   is_managedt   commit(    (    (    sC   /var/www/Pootle/local_apps/pootle_app/management/commands/initdb.pyR   !   s     

c          C   sy   d d k  l }  d d k l } | ƒ  } |  d d d | ƒ } d | _ d | _ d	 | _ d
 | _ d | _ | i	 ƒ  d S(   s   Create the default projects that we host. You might want to add your
    projects here, although you can also add things through the web interface
    later.iÿÿÿÿ(   t   Project(   t   require_englisht   codeu   tutorialt   source_languageu   Tutorials  <div dir='ltr' lang='en'>Tutorial project where users can play with Pootle and learn more about translation and localisation.<br />For more help on localisation, visit the <a href='http://translate.sourceforge.net/wiki/guide/start'>localisation guide</a>.</div>t   standardt   pot   autoN(
   t   pootle_project.modelsR   t   pootle_app.managementR   t   fullnamet   descriptiont
   checkstylet   localfiletypet	   treestylet   save(   R   R   t   ent   tutorial(    (    sC   /var/www/Pootle/local_apps/pootle_app/management/commands/initdb.pyR   9   s    	
					c          C   sn  d d k  l }  |  d d ƒ } d | _ d | _ d | _ d | _ | i ƒ  |  d d	 ƒ } d
 | _ d | _ d | _ d | _ | i ƒ  |  d d ƒ } d | _ d | _ d | _ | i ƒ  |  d d ƒ } d | _ d | _ d | _ d | _ | i ƒ  |  d d ƒ } d | _ d | _ d | _ d | _ | i ƒ  |  d d ƒ } d | _ d | _ d | _ | i ƒ  |  d d ƒ } d | _ d | _ d | _ d | _ | i ƒ  |  d d ƒ } d | _ d | _ d | _ d | _ | i ƒ  |  d d  ƒ }	 d! |	 _ d |	 _ d |	 _ d |	 _ |	 i ƒ  |  d d" ƒ }
 d# |
 _ d |
 _ d |
 _ |
 i ƒ  |  d d$ ƒ } d% | _ d | _ d | _ d& | _ | i ƒ  |  d d' ƒ } d( | _ | i ƒ  |  d d) ƒ } d* | _ d+ | _ d, | _ d- | _ | i ƒ  d d. k l } xd | i	 i
 ƒ  D]S \ } } y= |  i i d | d/ | d0 d1 | d2 d3 | d4 ƒ \ } } WqqXqWd5 S(6   s„   Create the default languages. We afford this priviledge to languages
    with reasonably complete interface translations for Pootle.iÿÿÿÿ(   t   LanguageR   t   afu	   Afrikaansu   Ã«Ã¯ÃªÃ´Ã»Ã¡Ã©Ã­Ã³ÃºÃ½t   2s   (n != 1)t   aku   Akanu   (n > 1)s   É›É”ÆÆ†u   2t   htu   Haitian; Haitian Creolet   nsou   Pedi; Sepedi; Northern Sothos   Å¡Å t   veu   Vendas    á¸“á¹‹á¸½á¹± á¸’á¹Šá¸¼á¹° á¹…á¹„t   wou   Woloft   zh_CNu   Chinese (China)t   1t   0u-   â†â†’â†”Ã—Ã·Â©â€¦â€”â€˜â€™â€œâ€ã€ã€‘ã€Šã€‹t   zh_HKu   Chinese (Hong Kong)u9   â†â†’â†”Ã—Ã·Â©â€¦â€”â€˜â€™â€œâ€ã€Œã€ã€Žã€ã€ã€‘ã€Šã€‹t   zh_TWu   Chinese (Taiwan)s   ca@valenciau   Catalan (Valencia)t   sonu   Songhai languagesu"   É²Å‹Å¡Å¾Ã£Ãµáº½Ä©ÆÅŠÅ Å½ÃƒÃ•áº¼Ä¨t   lgu   Gandat   gdu   Gaelic; Scottish Gaelict   4sE   (n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3u   Ã Ã²Ã¹Ã¨Ã¬Ã€ÃˆÃŒÃ’Ã™(   t   dataR   i    t   npluralsi   t   pluralequationi   N(   t   pootle_language.modelsR'   R   t   specialcharsR9   R:   R$   t   translate.langR8   t	   languagest   itemst   objectst   get_or_create(   R'   R(   R*   R+   R,   R-   R.   R/   R2   R3   t   ca_valenciaR4   R5   R6   R8   R   t   propst   langt   created(    (    sC   /var/www/Pootle/local_apps/pootle_app/management/commands/initdb.pyR   R   s¢    				
				
			
				
				
			
				
				
				
			
				
	
				
 !c          C   sB   t  d d d d d t d t d t ƒ }  |  i d ƒ |  i ƒ  d	 S(
   sâ   Create the default user(s) for Pootle. You definitely want to change
    the admin account so that your default install is not accessible with the
    default credentials. The users 'noboby' and 'default' should be left as is.t   usernameu   admint
   first_nameu   Administratort	   is_activet   is_superusert   is_stafft   adminN(   R   R   t   set_passwordR$   (   RK   (    (    sC   /var/www/Pootle/local_apps/pootle_app/management/commands/initdb.pyR   Ã   s    	(   t   ost   environt	   django.dbR   t   django.core.management.baseR   t   django.contrib.auth.modelsR   R   R   R   R   R   (    (    (    sC   /var/www/Pootle/local_apps/pootle_app/management/commands/initdb.pyt   <module>   s   			q