[Eric] Re: Rope plagin error

Tonal tonal at promsoft.ru
Sun Feb 3 16:41:26 GMT 2008


Ali Gholami Rudi wrote:
> It seems there is a problem with file encoding.  Would you attach a
> minimal ``src/ModelBusinessman.py`` file that produces this error?
Problem only in rope.

-- 
Alexandr N. Zamaraev
-------------- next part --------------
# -*- coding: cp1251 -*-
#
#$LastChangedRevision: 1669 $
#$LastChangedDate: 2008-01-29 16:06:51 +0600 (Вт, 29 янв 2008) $
#$LastChangedBy: nagual $
#$HeadURL: svn://breeze/mun_obr/main/doc_circ/src/ModelBusinessman.py $

u"""
Èíäèâèäóàëüíûé ïðåäïðèíèìàòåëü (ÈÏ)
"""

from PyQt4 import QtCore
from src.links.DataPhysDoc import Data as DataPhysDoc
import src.simple_dir.DataTown as DataTown
import src.simple_dir.DataGeonim as DataGeonim
from src.simple_dir.ModelDocType import DocType
from src.simple_dir.ModelDeliveryOrgan import DeliveryOrgan
from src.ModelUsers import User
from src.ModelPhysPerson import PhysPerson

from src.orm.Model import Entity
from src.orm.Property import (rebind,
  StrProperty, IdPropertys, DateProperty, IdCashPropertys, IntProperty)

from src.tools import deprecation

class Businessman(Entity):
  u"""
  Èíäèâèäóàëüíûé ïðåäïðèíèìàòåëü (ÈÏ)
  """
  
  __linkInfo = tuple()          # èíôîðìàöèÿ îá èçìåí¸ííûõ ñâÿçÿõ                              

  title = StrProperty(doc=u'Íàçâàíèå')
  physPersonId, physPersonObj, physPersonTitle = IdCashPropertys(
    PhysPerson, doc=u'Ôèçè÷åñêîå ëèöî')
  docTypeId, docTypeObj, docTypeTitle = IdCashPropertys(
    DocType, doc=u'Òèï ðåãèñòðàöèîííîãî äîêóìåíòà')
  regNumber = StrProperty(doc=u'¹ ñâèäåòåëüñòâà î ðåãèñòðàöèè â êà÷åñòâå ÈÏ')
  deliveryOrganId, deliveryOrganObj, deliveryOrganTitle = IdPropertys(
    DeliveryOrgan, doc=u'Êåì âûäàí ðåãèñòðàöèîííûé äîêóìåíò')
  deliveryDate = DateProperty(doc=u'Äàòà ðåãèñòðàöèîííîãî äîêóìåíòà')
  ogrn = StrProperty(doc=u'ÎÃÐÍ ÈÏ')
  rs = StrProperty(doc=u'ð/ñ ÈÏ')
  ks = StrProperty(doc=u'ê/ñ ÈÏ')
  bik = StrProperty(doc=u'ÁÈÊ ÈÏ')
  okonh = StrProperty(doc=u'ÎÊÎÍÕ ÈÏ')
  okpo = StrProperty(doc=u'ÎÊÏÎ ÈÏ')
  okvad = StrProperty(doc=u'ÎÊÂÝÂ ÈÏ')
  bankTownId, bankTownObj, bankTownTitle = IdPropertys(
    DataTown.Data, doc=u'Ãîðîä áàíêà')
  bankName = StrProperty(doc=u'Íàèìåíîâàíèå áàíêà ÈÏ')
  oldId = IntProperty(doc=u'Íîìåð â ñòàðîé ñèñòåìå')
  comments = StrProperty(doc=u'Êîììåíòàðèé')
  cUserId, cUserObj, cUserTitle = IdPropertys(
    User, doc=u'Ñîçäàâøèé ïîëüçîâàòåëü')
  cDate = DateProperty(doc=u'Äàòà-âðåìÿ ñîçäàíèÿ')
  mUserId, mUserObj, mUserTitle = IdPropertys(
    User, doc=u'Èçìåíèâøèé ïîëüçîâàòåëü')
  mDate = DateProperty(doc=u'Äàòà-âðåìÿ ïîñëåäíåãî èçìåíåíèÿ')

  def getPhysDocTitle(self):
    u"""
    @return Òèï:_Ñåðèÿ_Íîìåð 
    """
    obj = self.physPersonObj
    if obj:
      return obj.getPhysDocTitle()
    return ''

  def getPhysPersonTown(self):
    u"""
    @return íàñåëåííûé ïóíêò ôèç.ëèöà
    """
    obj = self.physPersonObj
    return obj.townTitle

  def getPhysPersonGeonim(self):
    u"""
    @return ãåîíèì ôèç.ëèöà
    """
    obj = self.physPersonObj
    return obj.geonimTitle

  def getPhysPersonBuilding(self):
    u"""
    @return êîðïóñ ôèç.ëèöà
    """
    obj = self.physPersonObj
    return obj.building

  def getPhysPersonHouse(self):
    u"""
    @return äîì ôèç.ëèöà
    """
    obj = self.physPersonObj
    return obj.house

  def getPhysPersonFlat(self):
    u"""
    @return êâàðòèðà ôèç.ëèöà
    """
    obj = self.physPersonObj
    return obj.flat

  def getPhysPersonBirthDay(self):
    u"""
    @return Äåíü ðîæäåíèÿ ôèç.ëèöà
    """
    obj = self.physPersonObj
    return obj.birthday

  def getPhysPersonPhone(self):
    u"""
    @return Äåíü ðîæäåíèÿ ôèç.ëèöà
    """
    obj = self.physPersonObj
    return obj.phone

  def getPhysPersonInn(self):
    u"""
    @return Äåíü ðîæäåíèÿ ôèç.ëèöà
    """
    obj = self.physPersonObj
    return obj.inn

  def getAddr(self):
    u"""
    @return ïîëíûé àäðåñ â âèäå ñòðîêè
    """
    return self.physPersonObj.getAddr()

  def getDoc(self):
    u"""
    Çäåñü íà ñàìîì äåëå âîçâðàùàåò ¹ ñâèäåòåëüñòâà î ãîñ.ðåã.þðèä.ëèöà
    Íóæíà çäåñü ñ òàêèì íàçâàíèåì, ÷òîá îáùàÿ äëÿ þð. è ôèç ëèö áûëà
    äëÿ ýêñïîðòà äàííûõ î ïðàâîîáëàäàòåëå â word
    """
    test = ''
    if self.__regNumber:
      test += u'¹ ' + (self.__regNumber or '')
    return test

class FilterBusinessman(Businessman):
  u"""
  Ôèëüòð ÈÏ
  """
  docType = set()                    # Òèï äîêóìåíòà óäîñòîâåðÿþùåãî ëè÷íîñòü
  birthdayBegin = DateProperty(doc=u'Äàòà ðîæäåíèÿ "c"')
  birthdayEnd = DateProperty(doc=u'Äàòà ðîæäåíèÿ "ïî"')
  deliveryDateBegin = DateProperty(doc=u'Äàòà âûäà÷è "ñ" äîêóìåíòà óäîñòîâåðÿþùåãî ëè÷íîñòü')
  deliveryDateEnd = DateProperty(doc=u'Äàòà âûäà÷è "ïî" äîêóìåíòà óäîñòîâåðÿþùåãî ëè÷íîñòü')

  number = StrProperty(doc=u'Ñåðèÿ è íîìåð äîêóìåíòà')
  deliveryOrgan = StrProperty(doc=u'Âûäàâøèé îðãàí')
  destrAddress = StrProperty(doc=u'Íåñòðóêòóðèðîâàííûé àäðåñ')
  building = StrProperty(doc=u'Íîìåð êîðïóñà ôèç.ëèöà')
  house = StrProperty(doc=u'Íîìåð äîìà ôèç.ëèöà')
  flat = StrProperty(doc=u'Íîìåð êâàðòèðû ôèç.ëèöà')
  fio = StrProperty(doc=u'ÔÈÎ ôèç.ëèöà')
  inn = StrProperty(doc=u'ÈÍÍ ôèç.ëèöà')
  phone = StrProperty(doc=u'Òåëåôîí ôèç.ëèöà')

  townId, townObj, townTitle = IdPropertys(DataTown.Data, doc=u'Ãîðîä')

  geonimId, geonimObj, geonimTitle = IdPropertys(
    DataGeonim.Data, doc=u'Ãåîíèì')

  def accept(self, obj):                                     
    if self.title and (not obj.title or self.title.lower() not in obj.title.lower()):
      return False
    physPersonObj = obj.physPersonObj
    physDoc = physPersonObj.physDocObj
    if self.docType and (not physDoc or physDoc.docTypeId not in self.docType):
      return False
    if self.number and (
      not physDoc or not physDoc.number or 
      self.number.lower() not in physDoc.number.lower()
    ):
      return False
    if self.deliveryOrgan and (
      not physDoc or not physDoc.deliveryOrgan or 
      self.deliveryOrgan.lower() not in physDoc.deliveryOrgan.lower()
    ):
      return False
    if self.fio and (
      not obj.physPersonObj.fio or 
      self.fio.lower() not in physPersonObj.fio.lower()
    ):
      return False
    if self.inn and (
      not physPersonObj.inn or 
      self.inn.lower() not in physPersonObj.inn.lower()
    ):
      return False
    if self.phone and (
      not physPersonObj.phone or 
      self.phone.lower() not in physPersonObj.phone.lower()
    ):
      return False
    if self.house and (
      not physPersonObj.house or 
      self.house.lower() not in physPersonObj.house.lower()
    ):
      return False
    if self.building and (
      not physPersonObj.building or
      self.building.lower() not in physPersonObj.building.lower()
    ):
      return False
    if self.flat and (
      not physPersonObj.flat or
      self.flat.lower() not in physPersonObj.flat.lower()
    ):
        return False
    if self.townId and self.townId != physPersonObj.townId:
      return False
    if self.geonimId and self.geonimId != physPersonObj.geonimId:
      return False
    if physPersonObj.birthday:
      if self.birthdayBegin and self.birthdayEnd and not (
        self.birthdayBegin <= physPersonObj.birthday <= self.birthdayEnd
      ):
        return False           
    else:
      if self.birthdayBegin and self.birthdayEnd:
        return False
    if self.regNumber and (
      not obj.regNumber or self.regNumber.lower() not in obj.regNumber.lower()
    ):
      return False
    if self.ogrn and (not obj.ogrn or self.ogrn.lower() not in obj.ogrn.lower()):
      return False
    if self.rs and (not obj.rs or self.rs.lower() not in obj.rs.lower()):
      return False
    if self.ks and (not obj.ks or self.ks.lower() not in obj.ks.lower()):
      return False
    if self.bik and (not obj.bik or self.bik.lower() not in obj.bik.lower()):
      return False
    if self.okonh and (not obj.okonh or self.okonh.lower() not in obj.okonh.lower()):
      return False
    if self.okpo and (not obj.okpo or self.okpo.lower() not in obj.okpo.lower()):
      return False
    if self.okvad and (not obj.okvad or self.okvad.lower() not in obj.okvad.lower()):
      return False
    return True



More information about the Eric mailing list