Asked  7 Months ago    Answers:  5   Viewed   46 times

Possible Duplicate:
How to read/make sense of a PHP serialised data string in python

I'm using python to access a database which is managed by a Drupal install. The data I want to access in Drupal in saved in the database as a PHP serialized object.

Are there any pre-built python modules which can deserialize a PHP serialized object into a python object? I've done some searching and come up with nothing.

I realize I could write my own parser from scratch but I'd rather use something thats been tried and tested.



Are you looking for phpserialize?

Wednesday, March 31, 2021
answered 7 Months ago

The key information in the link Nikit posted is $form_state['rebuild']. Here's some info from Drupal 7 documentation that I believe applies the same for Drupal 6...

$form_state['rebuild']: Normally, after the entire form processing is completed and submit handlers ran, a form is considered to be done and drupal_redirect_form() will redirect the user to a new page using a GET request (so a browser refresh does not re-submit the form). However, if 'rebuild' has been set to TRUE, then a new copy of the form is immediately built and sent to the browser; instead of a redirect. This is used for multi-step forms, such as wizards and confirmation forms. Also, if a form validation handler has set 'rebuild' to TRUE and a validation error occurred, then the form is rebuilt prior to being returned, enabling form elements to be altered, as appropriate to the particular validation error.

Wednesday, March 31, 2021
answered 7 Months ago

Basically, the signout.action requires session data i.e currently logged in user details but we are not able to send the session data through the curl. so its redirecting to the login.action. So it results in error code 302.

Saturday, May 29, 2021
answered 5 Months ago

Use max with axis=1:

df = df.max(axis=1)
print (df)
0    2.0
1    3.2
2    8.8
3    7.8
dtype: float64

And if need new column:

df['max_value'] = df.max(axis=1)
print (df)
     a    b     c  max_value
0  1.2  2.0  0.10        2.0
1  2.1  1.1  3.20        3.2
2  0.2  1.9  8.80        8.8
3  3.3  7.8  0.12        7.8
Tuesday, July 20, 2021
answered 3 Months ago

Select everything EXCEPT the last 3 columns, do this using iloc:

In [1639]: df
   a  b  c  d  e
0  1  3  2  2  2
1  2  4  1  1  1

In [1640]: df.iloc[:,:-3]
   a  b
0  1  3
1  2  4
Sunday, August 15, 2021
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :