;ς
ΎJFc           @   s-   d  Z  d k l Z d e f d     YZ d S(   sA   
   Copyright (C) 2006 PimenTech SARL (http://www.pimentech.net)

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with this library; see the file COPYING.LIB.  If not,
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  
(   s   Objects   PGEntityMapc           B   sh   t  Z d  Z d d  Z e d  Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
 d  Z RS(   s   
	Subclassed in pgroot
	s    c         C   s!   t  i |  | |  |  i   d  S(   N(   s   Objects   __init__s   selfs   ids   titles   reset_entities(   s   selfs   ids   title(    (    s   pgentitymap.pys   __init__   s    c         C   sm   | t j o( h  |  _ h  |  _ h  |  _ h  |  _ n5 g  |  i | <h  |  i | <h  |  i | <h  |  i | <d S(   s    delete entities N(   s   tables   Nones   selfs	   dict_sorts   dict_uids   dict_ztitles   dict_zid(   s   selfs   table(    (    s   pgentitymap.pys   reset_entities!   s     			c         C   s  |  i d |  |  i |  d | } | d j o d | } n xg |  i |  D]V \ } } } |  i	 | i
 |  | |  i | | <| |  i | | <| |  i | | <qS W| d j o@ d |  i | d <d i d  |  i | d <d |  i | d <n d	 |  _ d
 S(   s=   Charge une table entite dans les dico dict_uid et dic_zid_uids   Load Entity map for table %s sY   select uid, zid::text, ztitle::text from %s where uid!=0 and ref_statut=0 ORDER BY ztitles   statuts;   select uid, zid::text, ztitle::text from %s ORDER BY ztitlei    s   indefiniu	   IndΓ©finis   UTF-8i   N(   s   selfs   notices   tables   reset_entitiess   querys   fetchs   uids   zids   ztitles	   dict_sorts   appends   dict_uids   dict_ztitles   dict_zids   encodes
   _p_changed(   s   selfs   tables   uids   ztitles   zids   query(    (    s   pgentitymap.pys   __table_load.   s"     
 c         C   s8   |  i i |  o |  i |  n |  i | | Sd S(   s   Renvoie l'uid..N(   s   selfs   dict_zids   has_keys   tables   _PGEntityMap__table_loads   zid(   s   selfs   tables   zid(    (    s   pgentitymap.pys
   uid_entityA   s     c         C   s§   | t j o d Sn t |  } |  i i |  p |  i | i |  o |  i |  n |  i | i	 | d  } | d j o |  i d | | f  n | Sd S(   s   Renvoie le ztitles    s   Erreurs&   [ztitle_entity] %s unfound in table %sN(   s   uids   Nones   ints   selfs   dict_uids   has_keys   tables   dict_ztitles   _PGEntityMap__table_loads   gets   rets   error(   s   selfs   tables   uids   ret(    (    s   pgentitymap.pys   ztitle_entityG   s     ,c         C   s§   | t j o d Sn t |  } |  i i |  p |  i | i |  o |  i |  n |  i | i	 | d  } | d j o |  i d | | f  n | Sd S(   s   Renvoie le zids    s   Erreurs%   [zid_entity] %s not found in table %sN(   s   uids   Nones   ints   selfs   dict_uids   has_keys   tables   dict_ztitles   _PGEntityMap__table_loads   gets   rets   error(   s   selfs   tables   uids   ret(    (    s   pgentitymap.pys
   zid_entityS   s     ,c         C   s:   |  i i |  o |  i |  n |  i | i   Sd S(   s    renvoie le hash N(   s   selfs   dict_ztitles   has_keys   tables   _PGEntityMap__table_loads   items(   s   selfs   table(    (    s   pgentitymap.pys   get_ztitle_entities_   s     c         C   s>   |  i i |  o |  i |  n |  i | i   d Sd S(   s    renvoie le hash i   N(   s   selfs   dict_ztitles   has_keys   tables   _PGEntityMap__table_loads   items(   s   selfs   table(    (    s   pgentitymap.pys   ztitle_entitiese   s     s   ztitlec         C   s   |  i i |  o |  i |  n |  i | } | d j o | i   n g  } x, | D]$ } | i
 | |  i | | f  qZ W| Sd S(   s    renvoie le hash trie s   uidN(   s   selfs   dict_ztitles   has_keys   tables   _PGEntityMap__table_loads	   dict_sorts   keyss   sorts   rets   ks   append(   s   selfs   tables   sorts   keyss   rets   k(    (    s   pgentitymap.pys   ztitle_entities_2k   s      "(   s   __name__s
   __module__s   __doc__s   __init__s   Nones   reset_entitiess   _PGEntityMap__table_loads
   uid_entitys   ztitle_entitys
   zid_entitys   get_ztitle_entitiess   ztitle_entitiess   ztitle_entities_2(    (    (    s   pgentitymap.pys   PGEntityMap   s    						N(   s   __doc__s"   Products.PimenTechLibCommon.objects   Objects   PGEntityMap(   s   Objects   PGEntityMap(    (    s   pgentitymap.pys   ?   s   
