@@ -46,9 +46,11 @@ SCRIPT_MEMBER_DECLARE_BEGIN(Base)
4646SCRIPT_MEMBER_DECLARE_END ()
4747
4848ENTITY_GETSET_DECLARE_BEGIN (Base)
49- SCRIPT_GET_DECLARE (" cell" , pyGetCellMailbox, 0 , 0 )
50- SCRIPT_GET_DECLARE (" client" , pyGetClientMailbox, 0 , 0 )
51- SCRIPT_GET_DECLARE (" databaseID" , pyGetDBID, 0 , 0 )
49+ SCRIPT_GET_DECLARE (" cell" , pyGetCellMailbox, 0 , 0 )
50+ SCRIPT_GET_DECLARE (" client" , pyGetClientMailbox, 0 , 0 )
51+ SCRIPT_GET_DECLARE (" databaseID" , pyGetDBID, 0 , 0 )
52+ SCRIPT_GETSET_DECLARE (" shouldAutoBackup" , pyGetShouldAutoBackup, pySetShouldAutoBackup, 0 , 0 )
53+ SCRIPT_GETSET_DECLARE (" shouldAutoArchive" , pyGetShouldAutoArchive, pySetShouldAutoArchive, 0 , 0 )
5254ENTITY_GETSET_DECLARE_END ()
5355BASE_SCRIPT_INIT (Base, 0 , 0 , 0 , 0 , 0 )
5456
@@ -64,6 +66,8 @@ hasDB_(false),
6466DBID_ (0 ),
6567isGetingCellData_ (false ),
6668isArchiveing_ (false ),
69+ shouldAutoArchive_ (1 ),
70+ shouldAutoBackup_ (1 ),
6771creatingCell_ (false ),
6872createdSpace_ (false ),
6973inRestore_ (false )
@@ -123,7 +127,7 @@ void Base::onDestroy(void)
123127}
124128
125129// -------------------------------------------------------------------------------------
126- bool Base::installCellDataAttr (PyObject* dictData)
130+ bool Base::installCellDataAttr (PyObject* dictData, bool installpy )
127131{
128132 if (dictData != NULL )
129133 {
@@ -136,15 +140,22 @@ bool Base::installCellDataAttr(PyObject* dictData)
136140 Py_INCREF (cellDataDict_);
137141 }
138142 }
139- else if (cellDataDict_ == NULL )
140- cellDataDict_ = PyDict_New ();
141-
142- if (PyObject_SetAttrString (this , " cellData" , cellDataDict_) == -1 )
143+
144+ if (installpy)
143145 {
144- ERROR_MSG (" Base::installCellDataAttr: set property cellData is error!\n " );
145- SCRIPT_ERROR_CHECK ();
146- return false ;
146+ if (cellDataDict_ == NULL )
147+ {
148+ cellDataDict_ = PyDict_New ();
149+ }
150+
151+ if (PyObject_SetAttrString (this , " cellData" , cellDataDict_) == -1 )
152+ {
153+ ERROR_MSG (" Base::installCellDataAttr: set property cellData is error!\n " );
154+ SCRIPT_ERROR_CHECK ();
155+ return false ;
156+ }
147157 }
158+
148159 return true ;
149160}
150161
@@ -456,6 +467,9 @@ void Base::onDestroyEntity(bool deleteFromDB, bool writeToDB)
456467 {
457468 this ->hasDB (false );
458469 }
470+
471+ shouldAutoArchive_ = 0 ;
472+ shouldAutoBackup_ = 0 ;
459473}
460474
461475// -------------------------------------------------------------------------------------
@@ -510,6 +524,64 @@ PyObject* Base::pyGetClientMailbox()
510524 return mailbox;
511525}
512526
527+ // -------------------------------------------------------------------------------------
528+ int Base::pySetShouldAutoArchive (PyObject *value)
529+ {
530+ if (isDestroyed ())
531+ {
532+ PyErr_Format (PyExc_AssertionError, " %s: %d is destroyed!\n " ,
533+ getScriptName (), getID ());
534+ PyErr_PrintEx (0 );
535+ return 0 ;
536+ }
537+
538+ if (!PyLong_Check (value))
539+ {
540+ PyErr_Format (PyExc_AssertionError, " %s: %d set shouldAutoArchive value is not int!\n " ,
541+ getScriptName (), getID ());
542+ PyErr_PrintEx (0 );
543+ return 0 ;
544+ }
545+
546+ shouldAutoArchive_ = (int8)PyLong_AsLong (value);
547+ return 0 ;
548+ }
549+
550+ // -------------------------------------------------------------------------------------
551+ PyObject* Base::pyGetShouldAutoArchive ()
552+ {
553+ return PyLong_FromLong (shouldAutoArchive_);
554+ }
555+
556+ // -------------------------------------------------------------------------------------
557+ int Base::pySetShouldAutoBackup (PyObject *value)
558+ {
559+ if (isDestroyed ())
560+ {
561+ PyErr_Format (PyExc_AssertionError, " %s: %d is destroyed!\n " ,
562+ getScriptName (), getID ());
563+ PyErr_PrintEx (0 );
564+ return 0 ;
565+ }
566+
567+ if (!PyLong_Check (value))
568+ {
569+ PyErr_Format (PyExc_AssertionError, " %s: %d set shouldAutoBackup value is not int!\n " ,
570+ getScriptName (), getID ());
571+ PyErr_PrintEx (0 );
572+ return 0 ;
573+ }
574+
575+ shouldAutoBackup_ = (int8)PyLong_AsLong (value);
576+ return 0 ;
577+ }
578+
579+ // -------------------------------------------------------------------------------------
580+ PyObject* Base::pyGetShouldAutoBackup ()
581+ {
582+ return PyLong_FromLong (shouldAutoBackup_);
583+ }
584+
513585// -------------------------------------------------------------------------------------
514586void Base::onCreateCellFailure (void )
515587{
0 commit comments